diff --git a/tendie_reports.py b/tendie_reports.py index 70aef82..68ed31f 100644 --- a/tendie_reports.py +++ b/tendie_reports.py @@ -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