diff options
| author | Alexis Metaireau <alexis@notmyidea.org> | 2013-10-17 04:40:47 -0700 |
|---|---|---|
| committer | Alexis Metaireau <alexis@notmyidea.org> | 2013-10-17 04:40:47 -0700 |
| commit | 85a92e048583a9ca8cf6d5460124edb25e01ca95 (patch) | |
| tree | 633548145565bde6e3043814170c4f21f8960073 | |
| parent | 48b42ef499a919518f21494d858283b6a251d034 (diff) | |
| parent | 6f9fe3c1592ba2cc44f4197a37fd88447e1a1c53 (diff) | |
| download | ihatemoney-mirror-85a92e048583a9ca8cf6d5460124edb25e01ca95.zip ihatemoney-mirror-85a92e048583a9ca8cf6d5460124edb25e01ca95.tar.gz ihatemoney-mirror-85a92e048583a9ca8cf6d5460124edb25e01ca95.tar.bz2 | |
Merge pull request #114 from aavenel/bugfix104
bugfix #104 : ZeroDivisionError
| -rw-r--r-- | budget/models.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/budget/models.py b/budget/models.py index 900b1d0..c1372c0 100644 --- a/budget/models.py +++ b/budget/models.py @@ -218,7 +218,10 @@ class Bill(db.Model): def pay_each(self): """Compute what each person has to pay""" - return round(self.amount / len(self.owers), 2) + if self.owers: + return round(self.amount / len(self.owers), 2) + else: + return 0 def __repr__(self): return "<Bill of %s from %s for %s>" % (self.amount, |
