aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Avenel <avenel.alexandre@gmail.com>2015-07-05 22:16:38 +0200
committerAlexandre Avenel <avenel.alexandre@gmail.com>2015-07-05 22:16:38 +0200
commitb9458db08ec12ce3645fe21fde71e82bf8fde3d6 (patch)
tree4b825a98693c634bd6dcd282658c79ecd0812d3e
parent84aafc850e8262c7f8499d2919825a21c8278dde (diff)
downloadihatemoney-mirror-b9458db08ec12ce3645fe21fde71e82bf8fde3d6.zip
ihatemoney-mirror-b9458db08ec12ce3645fe21fde71e82bf8fde3d6.tar.gz
ihatemoney-mirror-b9458db08ec12ce3645fe21fde71e82bf8fde3d6.tar.bz2
Bugfix rounding settle algorithm
In some cases, settle algorithm failed to deliver optimal solution due to a rounding bug.
-rw-r--r--budget/models.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/budget/models.py b/budget/models.py
index 27bd80b..727200f 100644
--- a/budget/models.py
+++ b/budget/models.py
@@ -62,7 +62,7 @@ class Project(db.Model):
debts.append({"person": person, "balance": -balance[person.id]})
# Try and find exact matches
for credit in credits:
- match = self.exactmatch(credit["balance"], debts)
+ match = self.exactmatch(round(credit["balance"], 2), debts)
if match:
for m in match:
transactions.append({"ower": m["person"], "receiver": credit["person"], "amount": m["balance"]})