mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-12 09:24:15 -04:00
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:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user