mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-03 13:18:57 -04:00
Merge pull request #2646 from alphagov/cancelled_letters
Cancelled notifications do not show as failures on dashboard stats
This commit is contained in:
@@ -34,8 +34,7 @@
|
||||
link=None,
|
||||
show_failures=True,
|
||||
smaller=False,
|
||||
smallest=False,
|
||||
failed_as_cancelled=False
|
||||
smallest=False
|
||||
) %}
|
||||
<div class="big-number-with-status">
|
||||
{{ big_number(number, label, link=link, smaller=smaller, smallest=smallest) }}
|
||||
@@ -45,26 +44,14 @@
|
||||
{% if failure_link %}
|
||||
<a href="{{ failure_link }}">
|
||||
{{ "{:,}".format(failures) }}
|
||||
{% if failed_as_cancelled %}
|
||||
cancelled
|
||||
{% else %}
|
||||
failed – {{ failure_percentage }}%
|
||||
{% endif %}
|
||||
failed – {{ failure_percentage }}%
|
||||
</a>
|
||||
{% else %}
|
||||
{{ "{:,}".format(failures) }}
|
||||
{% if failed_as_cancelled %}
|
||||
cancelled
|
||||
{% else %}
|
||||
failed – {{ failure_percentage }}%
|
||||
{% endif %}
|
||||
failed – {{ failure_percentage }}%
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if failed_as_cancelled %}
|
||||
0 cancelled
|
||||
{% else %}
|
||||
No failures
|
||||
{% endif %}
|
||||
No failures
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -37,8 +37,7 @@
|
||||
statistics['letter']['show_warning'],
|
||||
failure_link=url_for(".view_notifications", service_id=service_id, message_type='letter', status='failed'),
|
||||
link=url_for(".view_notifications", service_id=service_id, message_type='letter', status=''),
|
||||
smaller=smaller_font_size,
|
||||
failed_as_cancelled=True
|
||||
smaller=smaller_font_size
|
||||
) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -5,8 +5,13 @@
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
{% from "components/form.html" import form_wrapper %}
|
||||
|
||||
{% set title_status = (
|
||||
'Failed '
|
||||
if status == 'failed' and message_type == 'letter'
|
||||
else ''
|
||||
) %}
|
||||
{% set page_title = (
|
||||
message_count_label(99, message_type, suffix='') | capitalize
|
||||
(title_status + message_count_label(99, message_type, suffix='')) | capitalize
|
||||
if current_user.has_permissions('view_activity')
|
||||
else 'Sent messages'
|
||||
) %}
|
||||
|
||||
@@ -40,7 +40,7 @@ from werkzeug.datastructures import MultiDict
|
||||
SENDING_STATUSES = ['created', 'pending', 'sending', 'pending-virus-check']
|
||||
DELIVERED_STATUSES = ['delivered', 'sent', 'returned-letter']
|
||||
FAILURE_STATUSES = ['failed', 'temporary-failure', 'permanent-failure',
|
||||
'technical-failure', 'virus-scan-failed', 'cancelled']
|
||||
'technical-failure', 'virus-scan-failed', 'validation-failed']
|
||||
REQUESTED_STATUSES = SENDING_STATUSES + DELIVERED_STATUSES + FAILURE_STATUSES
|
||||
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ from tests.conftest import (
|
||||
'created', 'pending', 'sending', 'pending-virus-check',
|
||||
'delivered', 'sent', 'returned-letter',
|
||||
'failed', 'temporary-failure', 'permanent-failure', 'technical-failure',
|
||||
'virus-scan-failed', 'cancelled',
|
||||
'virus-scan-failed', 'validation-failed'
|
||||
]
|
||||
),
|
||||
(
|
||||
@@ -66,7 +66,10 @@ from tests.conftest import (
|
||||
),
|
||||
(
|
||||
'failed',
|
||||
['failed', 'temporary-failure', 'permanent-failure', 'technical-failure', 'virus-scan-failed', 'cancelled']
|
||||
[
|
||||
'failed', 'temporary-failure', 'permanent-failure', 'technical-failure',
|
||||
'virus-scan-failed', 'validation-failed'
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
@@ -157,7 +157,7 @@ def test_jobs_page_doesnt_show_scheduled_on_page_2(
|
||||
'created', 'pending', 'sending', 'pending-virus-check',
|
||||
'delivered', 'sent', 'returned-letter',
|
||||
'failed', 'temporary-failure', 'permanent-failure', 'technical-failure',
|
||||
'virus-scan-failed', 'cancelled',
|
||||
'virus-scan-failed', 'validation-failed'
|
||||
]
|
||||
),
|
||||
(
|
||||
@@ -170,7 +170,10 @@ def test_jobs_page_doesnt_show_scheduled_on_page_2(
|
||||
),
|
||||
(
|
||||
'failed',
|
||||
['failed', 'temporary-failure', 'permanent-failure', 'technical-failure', 'virus-scan-failed', 'cancelled']
|
||||
[
|
||||
'failed', 'temporary-failure', 'permanent-failure', 'technical-failure', 'virus-scan-failed',
|
||||
'validation-failed'
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@@ -340,7 +343,7 @@ def test_should_show_letter_job(
|
||||
'permanent-failure',
|
||||
'technical-failure',
|
||||
'virus-scan-failed',
|
||||
'cancelled',
|
||||
'validation-failed'
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -191,20 +191,11 @@ def test_notification_page_shows_page_for_letter_notification(
|
||||
assert mock_page_count.call_args_list[0][1]['values'] == {'name': 'Jo'}
|
||||
|
||||
|
||||
@pytest.mark.parametrize('notification_status, expected_message', (
|
||||
(
|
||||
'permanent-failure',
|
||||
'Cancelled 1 January at 1:02am',
|
||||
),
|
||||
(
|
||||
'cancelled',
|
||||
'Cancelled 1 January at 1:02am',
|
||||
),
|
||||
(
|
||||
'validation-failed',
|
||||
'Validation failed – content is outside the printable area',
|
||||
),
|
||||
))
|
||||
@pytest.mark.parametrize('notification_status, expected_message', [
|
||||
('permanent-failure', 'Cancelled 1 January at 1:02am'),
|
||||
('cancelled', 'Cancelled 1 January at 1:02am'),
|
||||
('validation-failed', 'Validation failed – content is outside the printable area'),
|
||||
])
|
||||
@freeze_time("2016-01-01 01:01")
|
||||
def test_notification_page_shows_cancelled_letter(
|
||||
client_request,
|
||||
|
||||
Reference in New Issue
Block a user