diff options
Diffstat (limited to 'budget/models.py')
| -rw-r--r-- | budget/models.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/budget/models.py b/budget/models.py index 88d44ae..3aac120 100644 --- a/budget/models.py +++ b/budget/models.py @@ -61,9 +61,9 @@ class Project(db.Model): credits, debts, transactions = [],[],[] # Create lists of credits and debts for person in self.members: - if balance[person.id] > 0: + if round(balance[person.id], 2) > 0: credits.append({"person": person, "balance": balance[person.id]}) - elif balance[person.id] < 0: + elif round(balance[person.id], 2) < 0: debts.append({"person": person, "balance": -balance[person.id]}) # Try and find exact matches for credit in credits: @@ -111,7 +111,8 @@ class Project(db.Model): .filter(Bill.payer_id == Person.id)\ .filter(Person.project_id == Project.id)\ .filter(Project.id == self.id)\ - .order_by(Bill.date.desc()) + .order_by(Bill.date.desc())\ + .order_by(Bill.id.desc()) def remove_member(self, member_id): """Remove a member from the project. |
