Skip to content

Commit

Permalink
fixed payer report divide by 0 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyharrington committed May 21, 2020
1 parent 640748b commit 2fd423b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tendie_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ def generatePayersReport(userID):
totalPaid = totalPaid + payer["amount"]

# Calculate the % paid per payer and add to the data structure
for payer in payers:
payer["percentAmount"] = round((payer["amount"] / totalPaid) * 100)
if totalPaid != 0:
for payer in payers:
payer["percentAmount"] = round((payer["amount"] / totalPaid) * 100)

return payers
return payers
else:
return None

0 comments on commit 2fd423b

Please sign in to comment.