Skip to content

Commit

Permalink
fix the new check in Payday.resolve_takes()
Browse files Browse the repository at this point in the history
  • Loading branch information
Changaco committed Jan 10, 2025
1 parent 4a5a792 commit 09001b1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion liberapay/billing/payday.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def resolve_takes(tips, takes, ref_currency, payday_id):
# members who have now left the team or have zeroed takes.
transfers = list(transfers.values())
leftover = total_income - MoneyBasket(t.amount for t in transfers)
assert leftover >= 0
assert leftover >= 0, "leftover is negative"
if leftover and leftover_takes:
leftover_takes.sort(key=lambda t: t.member)
leftover_takes_fuzzy_sum = MoneyBasket(
Expand Down
4 changes: 2 additions & 2 deletions liberapay/i18n/currencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,9 @@ def __ne__(self, other):

def _compare(self, op, other):
if isinstance(other, self.__class__):
return self.amounts == other.amounts
return self.amounts.items() == other.amounts.items()
elif other == 0:
return any(op(v, 0) for v in self.amounts.values())
return all(op(v, 0) for v in self.amounts.values())
else:
raise TypeError(
"can't compare %r and %r" % (self.__class__, other.__class__)
Expand Down

0 comments on commit 09001b1

Please sign in to comment.