From 6280533b39ce227d000523a5727c84310c1bf09e Mon Sep 17 00:00:00 2001 From: "Cal.W" <20716204+calw20@users.noreply.github.com> Date: Sun, 28 Jun 2020 22:33:03 +1000 Subject: [PATCH] Fixed otherFeild lambda func not being used --- bankView.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bankView.py b/bankView.py index f6696a1..01c06b8 100644 --- a/bankView.py +++ b/bankView.py @@ -127,8 +127,8 @@ def calculateStats(transactions, yearRangeVal=None, monthRangeVal=None, otherFel if isinstance(monthRangeVal, list) or isinstance(monthRangeVal, tuple): monthRange = lambda x: x[1].month in monthRangeVal if isinstance(monthRangeVal, int) or isinstance(monthRangeVal, float): monthRange = lambda x: x[1].month == int(monthRangeVal) - if not isinstance(yearRangeVal, type(monthRange)): otherFelid = lambda x: True - + if not isinstance(otherFelid, type(monthRange)): otherFelid = lambda x: True + periodTransactions = [x for x in transactions if yearRange(x) and monthRange(x) and otherFelid(x)] periodTransactions = sorted(periodTransactions, reverse = True, key = lambda x: x[1]) @@ -163,7 +163,8 @@ import pprint if __name__ == "__main__": trans = loadTransactionData() - stats = calculateStats(trans, 2020, 1) + y = lambda x: x[-2] == TRANSACTION_TYPES[1] + stats = calculateStats(trans, 2020, 1, y) pprint.pprint(stats, indent=4) #calculateStats(trans)