mirror of
https://github.com/YunoHost-Apps/ihatemoney_ynh.git
synced 2024-09-03 19:26:15 +02:00
Bugfix rounding settle algorithm
In some cases, settle algorithm failed to deliver optimal solution due to a rounding bug.
This commit is contained in:
parent
84aafc850e
commit
b9458db08e
1 changed files with 1 additions and 1 deletions
|
@ -62,7 +62,7 @@ class Project(db.Model):
|
||||||
debts.append({"person": person, "balance": -balance[person.id]})
|
debts.append({"person": person, "balance": -balance[person.id]})
|
||||||
# Try and find exact matches
|
# Try and find exact matches
|
||||||
for credit in credits:
|
for credit in credits:
|
||||||
match = self.exactmatch(credit["balance"], debts)
|
match = self.exactmatch(round(credit["balance"], 2), debts)
|
||||||
if match:
|
if match:
|
||||||
for m in match:
|
for m in match:
|
||||||
transactions.append({"ower": m["person"], "receiver": credit["person"], "amount": m["balance"]})
|
transactions.append({"ower": m["person"], "receiver": credit["person"], "amount": m["balance"]})
|
||||||
|
|
Loading…
Reference in a new issue