Make sure all possible status are always returned

It makes it harded to parse the API response if you always have to check
if 'deleted' is set and if what value it has. I think to simply return 0
for all status value is good practice.
This commit is contained in:
Stefan Oderbolz 2015-11-17 11:43:11 +01:00
parent 5f96346487
commit f9b87fff0c
1 changed files with 1 additions and 1 deletions

View File

@ -37,7 +37,7 @@ def harvest_job_dictize(job, context):
func.count(HarvestObject.id).label('total_objects'))\
.filter_by(harvest_job_id=job.id)\
.group_by(HarvestObject.report_status).all()
out['stats'] = {}
out['stats'] = {'added': 0, 'updated': 0, 'errors': 0, 'deleted': 0}
for status, count in stats:
out['stats'][status] = count