feeder: factorize computation of generic status (#13028)
This commit is contained in:
parent
c89b7c8846
commit
688a2f0319
|
@ -535,8 +535,19 @@ class WcsFormdefFeeder(object):
|
|||
mapping[value] = self.insert_item_value(field, value)
|
||||
return mapping[value]
|
||||
|
||||
def generic_status(self, status):
|
||||
if status.endpoint:
|
||||
generic_status = 3
|
||||
elif status.startpoint:
|
||||
generic_status = 1
|
||||
else:
|
||||
generic_status = 2
|
||||
return generic_status
|
||||
|
||||
def do_data(self):
|
||||
values = []
|
||||
generic_evolution_values = []
|
||||
evolution_values = []
|
||||
for data in self.formdef.datas:
|
||||
|
||||
# ignore formdata without status
|
||||
|
@ -547,20 +558,13 @@ class WcsFormdefFeeder(object):
|
|||
channel = data.submission.channel.lower()
|
||||
if channel == 'web' and data.submission.backoffice:
|
||||
channel = 'backoffice'
|
||||
# Simplify status
|
||||
if status.endpoint:
|
||||
generic_status = 3
|
||||
elif status.startpoint:
|
||||
generic_status = 1
|
||||
else:
|
||||
generic_status = 2
|
||||
row = {
|
||||
'formdef_id': self.formdef_sql_id,
|
||||
'receipt_time': data.receipt_time,
|
||||
'hour_id': data.receipt_time.hour,
|
||||
'channel_id': self.channel_to_id[channel],
|
||||
'backoffice': data.submission.backoffice,
|
||||
'generic_status_id': generic_status,
|
||||
'generic_status_id': self.generic_status(status),
|
||||
'status_id': self.status_mapping[data.workflow.status.id],
|
||||
'endpoint_delay': data.endpoint_delay,
|
||||
'first_agent_id': self.get_first_agent_in_evolution(data),
|
||||
|
|
Loading…
Reference in New Issue