fixing change status next trade

This commit is contained in:
Cayo Puigdefabregas 2021-11-05 13:00:01 +01:00
parent 5ebf4f48b5
commit 6bf1354109
1 changed files with 10 additions and 10 deletions

View File

@ -66,7 +66,7 @@ class Metrics(MetricsMix):
If exist one trade before this action, then modify the trade action If exist one trade before this action, then modify the trade action
else, create one new row. else, create one new row.
""" """
if not self.last_trade: if self.act.trade not in self.trades:
# If not exist one trade, the status is of the Receive # If not exist one trade, the status is of the Receive
self.action_create_by = 'Receiver' self.action_create_by = 'Receiver'
self.status_receiver = self.act.type self.status_receiver = self.act.type
@ -77,14 +77,16 @@ class Metrics(MetricsMix):
self.rows.append(row) self.rows.append(row)
return return
if self.last_trade['trade_supplier'] == self.act.author.email: trade = self.trades[self.act.trade]
self.last_trade['status_supplier'] = self.act.type
self.last_trade['status_supplier_created'] = self.act.created if trade['trade_supplier'] == self.act.author.email:
trade['status_supplier'] = self.act.type
trade['status_supplier_created'] = self.act.created
return return
if self.last_trade['trade_receiver'] == self.act.author.email: if trade['trade_receiver'] == self.act.author.email:
self.last_trade['status_receiver'] = self.act.type trade['status_receiver'] = self.act.type
self.last_trade['status_receiver_created'] = self.act.created trade['status_receiver_created'] = self.act.created
return return
# import pdb; pdb.set_trace() # import pdb; pdb.set_trace()
@ -167,9 +169,7 @@ class Metrics(MetricsMix):
row['status_receiver'] = self.status_receiver row['status_receiver'] = self.status_receiver
row['status_supplier'] = '' row['status_supplier'] = ''
row['trade_confirmed'] = self.get_confirms() row['trade_confirmed'] = self.get_confirms()
# import pdb; pdb.set_trace() self.trades[self.act] = row
created = self.act.actions_device[0].created
self.trades[created] = row
self.rows.append(row) self.rows.append(row)
def get_metrics(self): def get_metrics(self):