X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=bluechips%2Fcontrollers%2Fspend.py;h=0bd830cc745c182174b9290160398e4a55c4cb70;hb=1de7ebf118cbe861456c45147497cdd55ed1d951;hp=c99d325ba10984b2fd1da0a508cf9479668ca8b3;hpb=c0ae50143ea14aec0b6db338674f2c1c29a86a3b;p=bluechips.git diff --git a/bluechips/controllers/spend.py b/bluechips/controllers/spend.py index c99d325..0bd830c 100644 --- a/bluechips/controllers/spend.py +++ b/bluechips/controllers/spend.py @@ -73,9 +73,12 @@ class SpendController(BaseController): try: share = [s.share for s in c.expenditure.splits if s.user == user][0] - percent = (Decimal(100) * Decimal(int(share)) / - Decimal(int(c.expenditure.amount))).\ - quantize(Decimal("0.001")) + if c.expenditure.amount == 0: + percent = 0 + else: + percent = (Decimal(100) * Decimal(int(share)) / + Decimal(int(c.expenditure.amount))).\ + quantize(Decimal("0.001")) except IndexError: percent = 0 c.values['shares-%d.amount' % ii] = percent