mirror of
https://github.com/YunoHost-Apps/ihatemoney_ynh.git
synced 2024-09-03 19:26:15 +02:00
bugfix #104 : ZeroDivisionError
- test if self.owers is null before returning value
This commit is contained in:
parent
a71d249e6c
commit
6f9fe3c159
1 changed files with 4 additions and 1 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue