From 09001b15feb02eed9da52825827a63f00bf97c13 Mon Sep 17 00:00:00 2001 From: Changaco Date: Fri, 10 Jan 2025 16:25:12 +0100 Subject: [PATCH] fix the new check in `Payday.resolve_takes()` --- liberapay/billing/payday.py | 2 +- liberapay/i18n/currencies.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/liberapay/billing/payday.py b/liberapay/billing/payday.py index 65f7e8527..6e185bea3 100644 --- a/liberapay/billing/payday.py +++ b/liberapay/billing/payday.py @@ -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( diff --git a/liberapay/i18n/currencies.py b/liberapay/i18n/currencies.py index 3bb355a46..a840f0a67 100644 --- a/liberapay/i18n/currencies.py +++ b/liberapay/i18n/currencies.py @@ -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__)