NoneType Fix #196

Merged
FlorianKellermann merged 4 commits from bot into main 2022-05-13 10:33:11 +00:00
146 changed files with 129 additions and 94 deletions
Showing only changes of commit aadfba74f0 - Show all commits

View File

@ -33,20 +33,23 @@ def get_portfolio():
# Otherwise calculate portfolio # Otherwise calculate portfolio
if transactions is not None: if transactions is not None:
for row in transactions: for row in transactions:
data = { if row[2] == 0:
"isin": row[0], continue
"comment": row[1], else:
"count": row[2], data = {
# "calculated_price": row[3], "isin": row[0],
"last_transaction": row[4], "comment": row[1],
'current_price': 0 "count": row[2],
} # "calculated_price": row[3],
"last_transaction": row[4],
'current_price': 0
}
# Add current share value to portfolio # Add current share value to portfolio
query_share_price = db.session.query(SharePrice).filter_by(isin=row[0]).order_by(SharePrice.date.desc()).first() query_share_price = db.session.query(SharePrice).filter_by(isin=row[0]).order_by(SharePrice.date.desc()).first()
if query_share_price is not None: if query_share_price is not None:
data['current_price'] = query_share_price.as_dict()['price'] data['current_price'] = query_share_price.as_dict()['price']
return_portfolio.append(data) return_portfolio.append(data)
return make_response(return_portfolio, 200, "Successfully loaded symbols") return make_response(return_portfolio, 200, "Successfully loaded symbols")

View File

@ -67,7 +67,7 @@ def get_transaction():
return_transactions = [] return_transactions = []
# Get all transactions # Get all transactions
transactions = db.session.query(Transaction).filter_by(email=email).all() transactions = db.session.query(Transaction).filter_by(email=email).order_by(Transaction.time.desc()).all()
# Iterate over transactions and add them to return_transactions # Iterate over transactions and add them to return_transactions
if transactions is not None: if transactions is not None:

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More