diff options
Diffstat (limited to 'ihatemoney/models.py')
| -rw-r--r-- | ihatemoney/models.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ihatemoney/models.py b/ihatemoney/models.py index 3c36e76..b9cff4f 100644 --- a/ihatemoney/models.py +++ b/ihatemoney/models.py @@ -376,8 +376,9 @@ class Bill(db.Model): def pay_each(self): """Compute what each share has to pay""" if self.owers: - # FIXME: SQL might dot that more efficiently - return self.amount / sum(i.weight for i in self.owers) + # FIXME: SQL might do that more efficiently + weights = sum(i.weight for i in self.owers) + return self.amount / weights else: return 0 |
