mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-26 16:20:19 -04:00
Merge pull request #918 from alphagov/catch-missing-statistics
Revert "Remove check for statistics not being on job"
This commit is contained in:
@@ -18,14 +18,15 @@ class JobApiClient(BaseAPIClient):
|
||||
@staticmethod
|
||||
def __convert_statistics(job):
|
||||
results = defaultdict(int)
|
||||
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']
|
||||
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']
|
||||
return results
|
||||
|
||||
def get_job(self, service_id, job_id=None, limit_days=None, status=None):
|
||||
|
||||
Reference in New Issue
Block a user