mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-12 09:58:50 -04:00
Include ‘created’ in ‘sending’ bucket
The difference between created and sending isn’t something a user should have to care about. So this commit: - counts created and sending as the same thing - displays and notifications which have a status of created as sending
This commit is contained in:
@@ -243,7 +243,8 @@ def format_notification_status(status, template_type):
|
||||
'temporary-failure': 'Inbox not accepting messages right now',
|
||||
'permanent-failure': 'Email address doesn’t exist',
|
||||
'delivered': 'Delivered',
|
||||
'sending': 'Sending'
|
||||
'sending': 'Sending',
|
||||
'created': 'Sending'
|
||||
},
|
||||
'sms': {
|
||||
'failed': 'Failed',
|
||||
@@ -251,7 +252,8 @@ def format_notification_status(status, template_type):
|
||||
'temporary-failure': 'Phone not accepting messages right now',
|
||||
'permanent-failure': 'Phone number doesn’t exist',
|
||||
'delivered': 'Delivered',
|
||||
'sending': 'Sending'
|
||||
'sending': 'Sending',
|
||||
'created': 'Sending'
|
||||
}
|
||||
}.get(template_type).get(status, status)
|
||||
|
||||
@@ -263,7 +265,8 @@ def format_notification_status_as_field_status(status):
|
||||
'temporary-failure': 'error',
|
||||
'permanent-failure': 'error',
|
||||
'delivered': None,
|
||||
'sending': 'default'
|
||||
'sending': 'default',
|
||||
'created': 'default'
|
||||
}.get(status, 'error')
|
||||
|
||||
|
||||
|
||||
@@ -48,10 +48,11 @@ def _parse_filter_args(filter_dict):
|
||||
|
||||
def _set_status_filters(filter_args):
|
||||
all_failure_statuses = ['failed', 'temporary-failure', 'permanent-failure', 'technical-failure']
|
||||
all_statuses = ['sending', 'delivered'] + all_failure_statuses
|
||||
all_sending_statuses = ['created', 'sending']
|
||||
all_statuses = all_sending_statuses + ['delivered'] + all_failure_statuses
|
||||
if filter_args.get('status'):
|
||||
if 'processed' in filter_args.get('status'):
|
||||
filter_args['status'] = all_statuses
|
||||
if 'sending' in filter_args.get('status'):
|
||||
filter_args['status'].extend(all_sending_statuses[:1])
|
||||
elif 'failed' in filter_args.get('status'):
|
||||
filter_args['status'].extend(all_failure_statuses[1:])
|
||||
else:
|
||||
@@ -291,12 +292,10 @@ def _get_job_counts(job, help_argument):
|
||||
job.get('notification_count', 0)
|
||||
],
|
||||
[
|
||||
'Sending', 'sending',
|
||||
(
|
||||
job.get('notification_count', 0) -
|
||||
job.get('notifications_delivered', 0) -
|
||||
job.get('notifications_failed', 0)
|
||||
)
|
||||
'sending', 'sending',
|
||||
job.get('notification_count', 0) -
|
||||
job.get('notifications_delivered', 0) -
|
||||
job.get('notifications_failed', 0)
|
||||
],
|
||||
[
|
||||
'delivered', 'delivered',
|
||||
|
||||
@@ -32,15 +32,11 @@ def test_should_return_list_of_all_jobs(app_,
|
||||
"status_argument, expected_api_call", [
|
||||
(
|
||||
'',
|
||||
['sending', 'delivered', 'failed', 'temporary-failure', 'permanent-failure', 'technical-failure']
|
||||
),
|
||||
(
|
||||
'processed',
|
||||
['sending', 'delivered', 'failed', 'temporary-failure', 'permanent-failure', 'technical-failure']
|
||||
['created', 'sending', 'delivered', 'failed', 'temporary-failure', 'permanent-failure', 'technical-failure']
|
||||
),
|
||||
(
|
||||
'sending',
|
||||
['sending']
|
||||
['sending', 'created']
|
||||
),
|
||||
(
|
||||
'delivered',
|
||||
@@ -180,11 +176,11 @@ def test_should_show_updates_for_one_job_as_json(
|
||||
"status_argument, expected_api_call", [
|
||||
(
|
||||
'',
|
||||
['sending', 'delivered', 'failed', 'temporary-failure', 'permanent-failure', 'technical-failure']
|
||||
['created', 'sending', 'delivered', 'failed', 'temporary-failure', 'permanent-failure', 'technical-failure']
|
||||
),
|
||||
(
|
||||
'sending',
|
||||
['sending']
|
||||
['sending', 'created']
|
||||
),
|
||||
(
|
||||
'delivered',
|
||||
|
||||
Reference in New Issue
Block a user