mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 07:21:13 -05:00
Replace how .dump is called
As with `.load`, only data is now returned instead of a tuple.
This commit is contained in:
@@ -50,7 +50,7 @@ register_errors(job_blueprint)
|
||||
def get_job_by_service_and_job_id(service_id, job_id):
|
||||
job = dao_get_job_by_service_id_and_job_id(service_id, job_id)
|
||||
statistics = dao_get_notification_outcomes_for_job(service_id, job_id)
|
||||
data = job_schema.dump(job).data
|
||||
data = job_schema.dump(job)
|
||||
|
||||
data['statistics'] = [{'status': statistic[1], 'count': statistic[0]} for statistic in statistics]
|
||||
|
||||
@@ -97,7 +97,7 @@ def get_all_notifications_for_service_job(service_id, job_id):
|
||||
if data.get('format_for_csv'):
|
||||
notifications = [notification.serialize_for_csv() for notification in paginated_notifications.items]
|
||||
else:
|
||||
notifications = notification_with_template_schema.dump(paginated_notifications.items, many=True).data
|
||||
notifications = notification_with_template_schema.dump(paginated_notifications.items, many=True)
|
||||
|
||||
return jsonify(
|
||||
notifications=notifications,
|
||||
@@ -185,7 +185,7 @@ def create_job(service_id):
|
||||
if job.job_status == JOB_STATUS_PENDING:
|
||||
process_job.apply_async([str(job.id)], {'sender_id': sender_id}, queue=QueueNames.JOBS)
|
||||
|
||||
job_json = job_schema.dump(job).data
|
||||
job_json = job_schema.dump(job)
|
||||
job_json['statistics'] = []
|
||||
|
||||
return jsonify(data=job_json), 201
|
||||
@@ -219,7 +219,7 @@ def get_paginated_jobs(
|
||||
statuses=statuses,
|
||||
contact_list_id=contact_list_id,
|
||||
)
|
||||
data = job_schema.dump(pagination.items, many=True).data
|
||||
data = job_schema.dump(pagination.items, many=True)
|
||||
for job_data in data:
|
||||
start = job_data['processing_started']
|
||||
start = dateutil.parser.parse(start).replace(tzinfo=None) if start else None
|
||||
|
||||
Reference in New Issue
Block a user