mirror of
https://github.com/YunoHost-Apps/ihatemoney_ynh.git
synced 2024-09-03 19:26:15 +02:00
Prevent transfers with a zero amount in the settle page
This workarounds a rounding issue caused by the (incorrect) usage of floats for bill amounts. This fixes #138
This commit is contained in:
parent
543df7c1d4
commit
b507a5afa1
1 changed files with 2 additions and 2 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue