mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 02:11:11 -05:00
Merge pull request #2732 from alphagov/return-letter-upload-recipient
Return recipient for letter uploads
This commit is contained in:
@@ -30,7 +30,8 @@ def dao_get_uploads_by_service_id(service_id, limit_days=None, page=1, page_size
|
||||
Job.scheduled_for.label("scheduled_for"),
|
||||
Job.processing_started.label('processing_started'),
|
||||
Job.job_status.label("status"),
|
||||
literal('job').label('upload_type')
|
||||
literal('job').label('upload_type'),
|
||||
literal(None).label('recipient'),
|
||||
).join(
|
||||
Template, Job.template_id == Template.id
|
||||
).filter(
|
||||
@@ -58,7 +59,8 @@ def dao_get_uploads_by_service_id(service_id, limit_days=None, page=1, page_size
|
||||
# letters don't have a processing_started date but we want created_at to be used for sorting
|
||||
Notification.created_at.label('processing_started'),
|
||||
Notification.status,
|
||||
literal('letter').label('upload_type')
|
||||
literal('letter').label('upload_type'),
|
||||
Notification.to.label('recipient'),
|
||||
).join(
|
||||
Template, Notification.template_id == Template.id
|
||||
).filter(
|
||||
|
||||
@@ -44,7 +44,8 @@ def get_paginated_uploads(service_id, limit_days, page):
|
||||
'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"),
|
||||
'upload_type': upload.upload_type,
|
||||
'template_type': None,
|
||||
'template_type': upload.template_type,
|
||||
'recipient': upload.recipient,
|
||||
}
|
||||
if upload.upload_type == 'job':
|
||||
start = upload.processing_started
|
||||
@@ -59,7 +60,6 @@ def get_paginated_uploads(service_id, limit_days, page):
|
||||
statistics = dao_get_notification_outcomes_for_job(service_id, upload.id)
|
||||
upload_dict['statistics'] = [{'status': statistic.status, 'count': statistic.count} for statistic in
|
||||
statistics]
|
||||
upload_dict['template_type'] = upload.template_type
|
||||
else:
|
||||
upload_dict['statistics'] = [{'status': upload.status, 'count': 1}]
|
||||
data.append(upload_dict)
|
||||
|
||||
Reference in New Issue
Block a user