mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-18 21:44:11 -04:00
Add filters for ‘processed’ and sending states
- _Processed_ is all the notifications that we know about, ie sending,
failed and delivered
- _Sending_ is notifications that we have either put into a queue or are
waiting to hear back from the provider about.
The big numbers on the dashboard are a count of all the messages we’ve
processed. So when you click them, the table of notifications you see
on the dashboard should contain that number of notifications.
This also gets the activity page one step closer to being like the job
page:
| Before | After
---------|----------------------------|---------------------------------
Activity | Sending, failed, both | Processed, sending, failed, delivered
Job page | Sending, failed, delivered | Sending, failed, delivered
This commit is contained in:
@@ -43,12 +43,15 @@ 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
|
||||
if filter_args.get('status'):
|
||||
if 'failed' in filter_args.get('status'):
|
||||
filter_args['status'].extend(['temporary-failure', 'permanent-failure', 'technical-failure'])
|
||||
if 'processed' in filter_args.get('status'):
|
||||
filter_args['status'] = all_statuses
|
||||
elif 'failed' in filter_args.get('status'):
|
||||
filter_args['status'].extend(all_failure_statuses[1:])
|
||||
else:
|
||||
# default to everything
|
||||
filter_args['status'] = ['delivered', 'failed', 'temporary-failure', 'permanent-failure', 'technical-failure']
|
||||
filter_args['status'] = all_statuses
|
||||
|
||||
|
||||
@main.route("/services/<service_id>/jobs")
|
||||
@@ -232,9 +235,10 @@ def view_notifications(service_id, message_type):
|
||||
message_type=message_type,
|
||||
status=item[1]
|
||||
)] for item in [
|
||||
['Successful', 'delivered'],
|
||||
['Processed', 'sending,delivered,failed'],
|
||||
['Sending', 'sending'],
|
||||
['Delivered', 'delivered'],
|
||||
['Failed', 'failed'],
|
||||
['', 'delivered,failed']
|
||||
]
|
||||
]
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
statistics.get('emails_failure_rate', 0.0),
|
||||
statistics.get('emails_failure_rate', 0)|float > 3,
|
||||
failure_link=url_for(".view_notifications", service_id=current_service.id, message_type='email', status='failed'),
|
||||
label_link=url_for(".view_notifications", service_id=current_service.id, message_type='email', status='delivered,failed')
|
||||
label_link=url_for(".view_notifications", service_id=current_service.id, message_type='email', status='sending,delivered,failed')
|
||||
) }}
|
||||
</div>
|
||||
<div class="column-half">
|
||||
@@ -30,7 +30,7 @@
|
||||
statistics.get('sms_failure_rate', 0.0),
|
||||
statistics.get('sms_failure_rate', 0)|float > 3,
|
||||
failure_link=url_for(".view_notifications", service_id=current_service.id, message_type='sms', status='failed'),
|
||||
label_link=url_for(".view_notifications", service_id=current_service.id, message_type='sms', status='delivered,failed')
|
||||
label_link=url_for(".view_notifications", service_id=current_service.id, message_type='sms', status='sending,delivered,failed')
|
||||
) }}
|
||||
</div>
|
||||
<div class="column-whole">
|
||||
|
||||
@@ -87,6 +87,14 @@ def test_should_show_updates_for_one_job_as_json(
|
||||
)
|
||||
@pytest.mark.parametrize(
|
||||
"status_argument, expected_api_call", [
|
||||
(
|
||||
'processed',
|
||||
['sending', 'delivered', 'failed', 'temporary-failure', 'permanent-failure', 'technical-failure']
|
||||
),
|
||||
(
|
||||
'sending',
|
||||
['sending']
|
||||
),
|
||||
(
|
||||
'delivered',
|
||||
['delivered']
|
||||
@@ -94,10 +102,6 @@ def test_should_show_updates_for_one_job_as_json(
|
||||
(
|
||||
'failed',
|
||||
['failed', 'temporary-failure', 'permanent-failure', 'technical-failure']
|
||||
),
|
||||
(
|
||||
'delivered,failed',
|
||||
['delivered', 'failed', 'temporary-failure', 'permanent-failure', 'technical-failure']
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user