diff options
| author | A.Avenel <avenel.alexandre@gmail.com> | 2013-10-12 17:28:15 +0200 |
|---|---|---|
| committer | A.Avenel <avenel.alexandre@gmail.com> | 2013-10-12 17:28:15 +0200 |
| commit | 6f9fe3c1592ba2cc44f4197a37fd88447e1a1c53 (patch) | |
| tree | c6f5d6802665aeafd0932b906a1ff5f9ad8e7c06 /budget | |
| parent | a71d249e6c35b9a204d50e40365945c359ee5b63 (diff) | |
| download | ihatemoney-mirror-6f9fe3c1592ba2cc44f4197a37fd88447e1a1c53.zip ihatemoney-mirror-6f9fe3c1592ba2cc44f4197a37fd88447e1a1c53.tar.gz ihatemoney-mirror-6f9fe3c1592ba2cc44f4197a37fd88447e1a1c53.tar.bz2 | |
bugfix #104 : ZeroDivisionError
- test if self.owers is null before returning value
Diffstat (limited to 'budget')
| -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, |
