Pass through template_type from DAO

The DAO sets template type to `None` for one-off letters, so the REST
method doesn’t need to do any special handling of it.
This commit is contained in:
Chris Hill-Scott
2020-02-28 09:58:13 +00:00
parent c7895df82c
commit f57b5445c3

View File

@@ -44,7 +44,7 @@ def get_paginated_uploads(service_id, limit_days, page):
'created_at': upload.scheduled_for.strftime( 'created_at': upload.scheduled_for.strftime(
"%Y-%m-%d %H:%M:%S") if upload.scheduled_for else upload.created_at.strftime("%Y-%m-%d %H:%M:%S"), "%Y-%m-%d %H:%M:%S") if upload.scheduled_for else upload.created_at.strftime("%Y-%m-%d %H:%M:%S"),
'upload_type': upload.upload_type, 'upload_type': upload.upload_type,
'template_type': None, 'template_type': upload.template_type,
'recipient': upload.recipient, 'recipient': upload.recipient,
} }
if upload.upload_type == 'job': if upload.upload_type == 'job':
@@ -60,7 +60,6 @@ def get_paginated_uploads(service_id, limit_days, page):
statistics = dao_get_notification_outcomes_for_job(service_id, upload.id) statistics = dao_get_notification_outcomes_for_job(service_id, upload.id)
upload_dict['statistics'] = [{'status': statistic.status, 'count': statistic.count} for statistic in upload_dict['statistics'] = [{'status': statistic.status, 'count': statistic.count} for statistic in
statistics] statistics]
upload_dict['template_type'] = upload.template_type
else: else:
upload_dict['statistics'] = [{'status': upload.status, 'count': 1}] upload_dict['statistics'] = [{'status': upload.status, 'count': 1}]
data.append(upload_dict) data.append(upload_dict)