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)