Remove check for statistics not being on job

A job will always have statistics.

It’s always assigned:
bcfa83de79/app/job/rest.py (L48)

And the structure should always be the same, even if the counts are
zero because they’re generated from this query:
668e6c9716/app/dao/jobs_dao.py (L11-L22)

This line suggests that it’s a hangover from the aggregate tables:
8c159da3ea (diff-9886486bf41b0680d23588b190c252eaL24)

Since it’s no long necessary this commit removes it.
This commit is contained in:
Chris Hill-Scott
2016-08-31 10:46:43 +01:00
parent bf872ab342
commit 40e22d8258

View File

@@ -18,15 +18,14 @@ class JobApiClient(BaseAPIClient):
@staticmethod
def __convert_statistics(job):
results = defaultdict(int)
if 'statistics' in job:
for outcome in job['statistics']:
if outcome['status'] in ['failed', 'technical-failure', 'temporary-failure', 'permanent-failure']:
results['failed'] += outcome['count']
if outcome['status'] in ['sending', 'pending', 'created']:
results['sending'] += outcome['count']
if outcome['status'] in ['delivered']:
results['delivered'] += outcome['count']
results['requested'] += outcome['count']
for outcome in job['statistics']:
if outcome['status'] in ['failed', 'technical-failure', 'temporary-failure', 'permanent-failure']:
results['failed'] += outcome['count']
if outcome['status'] in ['sending', 'pending', 'created']:
results['sending'] += outcome['count']
if outcome['status'] in ['delivered']:
results['delivered'] += outcome['count']
results['requested'] += outcome['count']
return results
def get_job(self, service_id, job_id=None, limit_days=None, status=None):