Removed misc print statements
This commit is contained in:
parent
ee0367b495
commit
ccd1b813a4
14
bankView.py
14
bankView.py
@ -127,18 +127,11 @@ 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, 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 isinstance(monthRangeVal, int) or isinstance(monthRangeVal, float): monthRange = lambda x: x[1].month == int(monthRangeVal)
|
||||||
|
|
||||||
if not isinstance(yearRangeVal, type(monthRangeVal)): otherFelid = lambda x: True
|
if not isinstance(yearRangeVal, type(monthRange)): otherFelid = lambda x: True
|
||||||
|
|
||||||
periodTransactions = [x for x in transactions if yearRange(x) and monthRange(x) and otherFelid(x)]
|
periodTransactions = [x for x in transactions if yearRange(x) and monthRange(x) and otherFelid(x)]
|
||||||
print(periodTransactions)
|
|
||||||
print("*"*70)
|
|
||||||
periodTransactions = sorted(periodTransactions, reverse = True, key = lambda x: x[1])
|
periodTransactions = sorted(periodTransactions, reverse = True, key = lambda x: x[1])
|
||||||
|
|
||||||
print(periodTransactions)
|
|
||||||
|
|
||||||
input("$"*70)
|
|
||||||
|
|
||||||
|
|
||||||
stats = {
|
stats = {
|
||||||
"credits" : 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),
|
"credits" : 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),
|
||||||
"debits" : 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),
|
"debits" : 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),
|
||||||
@ -154,6 +147,7 @@ def calculateStats(transactions, yearRangeVal=None, monthRangeVal=None, otherFel
|
|||||||
|
|
||||||
return stats
|
return stats
|
||||||
|
|
||||||
|
|
||||||
def foo(transactions):
|
def foo(transactions):
|
||||||
years = []
|
years = []
|
||||||
for trans in transactions:
|
for trans in transactions:
|
||||||
@ -166,8 +160,8 @@ def foo(transactions):
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
trans = loadTransactionData()
|
trans = loadTransactionData()
|
||||||
y = lambda x: x[-2] == TRANSACTION_TYPES[0]
|
stats = calculateStats(trans)
|
||||||
print(calculateStats(trans, otherFelid=y))
|
print(stats['averageBalance'])
|
||||||
|
|
||||||
#calculateStats(trans)
|
#calculateStats(trans)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user