aboutsummaryrefslogtreecommitdiff
path: root/budget/models.py
diff options
context:
space:
mode:
authorAlexis Metaireau <alexis@notmyidea.org>2017-01-16 21:13:56 +0100
committerGitHub <noreply@github.com>2017-01-16 21:13:56 +0100
commitdc75a72dd0caeafce20b09d3ad538bdcbabf4408 (patch)
tree49b0a33793fd626a0251b3662e8af45f3bb5b4ff /budget/models.py
parentd33f4a92a6384937169881f78e52afdb76412a20 (diff)
parentd6cf89008fdb5e40395d3ccc879db2255f13e461 (diff)
downloadihatemoney-mirror-dc75a72dd0caeafce20b09d3ad538bdcbabf4408.zip
ihatemoney-mirror-dc75a72dd0caeafce20b09d3ad538bdcbabf4408.tar.gz
ihatemoney-mirror-dc75a72dd0caeafce20b09d3ad538bdcbabf4408.tar.bz2
Merge pull request #164 from zorun/fix_zero_transfers
Fix zero-amount transfers and other rounding issues
Diffstat (limited to 'budget/models.py')
-rw-r--r--budget/models.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/budget/models.py b/budget/models.py
index 9538670..0670d6e 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: