diff --git a/bankView.py b/bankView.py index 918c6ca..f6696a1 100644 --- a/bankView.py +++ b/bankView.py @@ -135,8 +135,8 @@ def calculateStats(transactions, yearRangeVal=None, monthRangeVal=None, otherFel stats = { "totalCredits" : round(sum([abs(x[2]) for x in periodTransactions if x[2] > 0]), 2) if len([abs(x[2]) for x in periodTransactions if x[2] > 0]) > 0 else float(0), "totalDebits" : round(sum([abs(x[2]) for x in periodTransactions if x[2] < 0]), 2) if len([abs(x[2]) for x in periodTransactions if x[2] < 0]) > 0 else float(0), - "largestCredit" : max(periodTransactions, key=lambda x: x[2]) if len(periodTransactions) > 0 else (datetime.now(), datetime.now(), 0, "", 0, "", ""), - "largestDebit" : min(periodTransactions, key=lambda x: x[2]) if len(periodTransactions) > 0 else (datetime.now(), datetime.now(), 0, "", 0, "", ""), + "largestCredit" : max(periodTransactions, key=lambda x: x[2]) if len(periodTransactions) > 0 else None, + "largestDebit" : min(periodTransactions, key=lambda x: x[2]) if len(periodTransactions) > 0 else None, "averageCredit" : round(statistics.fmean([abs(x[2]) for x in periodTransactions if x[2] > 0]), 2) if len([abs(x[2]) for x in periodTransactions if x[2] > 0]) > 0 else float(0), "averageDebit" : round(statistics.fmean([abs(x[2]) for x in periodTransactions if x[2] < 0]), 2) if len([abs(x[2]) for x in periodTransactions if x[2] < 0]) > 0 else float(0), "netBalance" : round(sum([x[2] for x in periodTransactions]), 2) if len(periodTransactions) > 0 else float(0),