Skip to content

Commit 0b034a1

Browse files
committed
Maybe fix Nones on Trade page
1 parent 58b235e commit 0b034a1

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

thing/views.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -621,10 +621,12 @@ def trade(request):
621621
row['buy_total'] = trans.filter(buy_transaction=True).aggregate(Sum('total_price'))['total_price__sum']
622622
row['sell_total'] = trans.filter(buy_transaction=False).aggregate(Sum('total_price'))['total_price__sum']
623623

624-
if row['buy_total'] is None or row['sell_total'] is None:
625-
row['balance'] = 0
626-
else:
627-
row['balance'] = row['sell_total'] - row['buy_total']
624+
if row['buy_total'] is None:
625+
row['buy_total'] = 0
626+
if row['sell_total'] is None:
627+
row['sell_total'] = 0
628+
629+
row['balance'] = row['sell_total'] - row['buy_total']
628630

629631
t_data.append(row)
630632

0 commit comments

Comments
 (0)