wcs_olap: add a backoffice channel

This commit is contained in:
Benjamin Dauvergne 2016-06-18 09:28:47 +02:00
parent 247df4bce9
commit 3a6303095d
1 changed files with 5 additions and 1 deletions

View File

@ -246,6 +246,7 @@ class WcsOlapFeeder(object):
[2, 'mail', u'courrier'],
[3, 'phone', u'téléphone'],
[4, 'counter', u'guichet'],
[5, 'backoffice', u'backoffice'],
]
channel_to_id = dict((c[1], c[0]) for c in channels)
id_to_channel = dict((c[0], c[1]) for c in channels)
@ -484,11 +485,14 @@ class WcsFormdefFeeder(object):
continue
status = data.formdef.schema.workflow.statuses_map[data.workflow.status.id]
channel = data.submission.channel.lower()
if channel == 'web' and data.submission.backoffice:
channel = 'backoffice'
row = {
'formdef_id': self.formdef_sql_id,
'receipt_time': data.receipt_time,
'hour_id': data.receipt_time.hour,
'channel_id': self.channel_to_id[data.submission.channel.lower()],
'channel_id': self.channel_to_id[channel],
'backoffice': data.submission.backoffice,
# FIXME "En cours"/2 is never used
'generic_status_id': 3 if status.endpoint else 1,