Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
don't forget takes when recomputing receiving amounts
Browse files Browse the repository at this point in the history
  • Loading branch information
Changaco committed Jun 14, 2014
1 parent 2b9eea3 commit e1bf52c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gittip/billing/payday.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ def update_receiving_amounts(self):
GROUP BY tippee;
UPDATE participants
SET receiving = amount
SET receiving = (amount + takes)
FROM total_receiving
WHERE tippee = username;
"""
Expand Down
4 changes: 2 additions & 2 deletions gittip/models/participant.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,15 +610,15 @@ def update_pledging(self, cursor=None):
def update_receiving(self, cursor=None):
receiving = (cursor or self.db).one("""
UPDATE participants p
SET receiving = COALESCE((
SET receiving = (COALESCE((
SELECT sum(amount)
FROM current_tips
JOIN participants p2 ON p2.username = tipper
WHERE tippee = p.username
AND p2.is_suspicious IS NOT true
AND p2.last_bill_result = ''
GROUP BY tippee
), 0)
), 0) + takes)
WHERE p.username = %s
RETURNING receiving
""", (self.username,))
Expand Down

1 comment on commit e1bf52c

@chadwhitacre
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With tests in f7b3321, I'm good on this commit.

Please sign in to comment.