diff --git a/ihatemoney/models.py b/ihatemoney/models.py index 212f8949..8c28c9c0 100644 --- a/ihatemoney/models.py +++ b/ihatemoney/models.py @@ -114,12 +114,13 @@ class Project(db.Model): balances, should_pay, should_receive = (defaultdict(int) for time in (1, 2, 3)) for bill in self.get_bills_unordered().all(): - should_receive[bill.payer.id] += bill.converted_amount - total_weight = sum(ower.weight for ower in bill.owers) - for ower in bill.owers: - should_pay[ower.id] += ( - ower.weight * bill.converted_amount / total_weight - ) + if not bill.archive: + should_receive[bill.payer.id] += bill.converted_amount + total_weight = sum(ower.weight for ower in bill.owers) + for ower in bill.owers: + should_pay[ower.id] += ( + ower.weight * bill.converted_amount / total_weight + ) for person in self.members: balance = should_receive[person.id] - should_pay[person.id]