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:
parent
5f96346487
commit
f9b87fff0c
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue