We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 58b235e commit 0b034a1Copy full SHA for 0b034a1
1 file changed
thing/views.py
@@ -621,10 +621,12 @@ def trade(request):
621
row['buy_total'] = trans.filter(buy_transaction=True).aggregate(Sum('total_price'))['total_price__sum']
622
row['sell_total'] = trans.filter(buy_transaction=False).aggregate(Sum('total_price'))['total_price__sum']
623
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']
+ if row['buy_total'] is None:
+ row['buy_total'] = 0
+ if row['sell_total'] is None:
+ row['sell_total'] = 0
628
+
629
+ row['balance'] = row['sell_total'] - row['buy_total']
630
631
t_data.append(row)
632
0 commit comments