Cancelled notifications do not show as failures on dashboard stats

Also update tests after we no longer show cancelled letters
This commit is contained in:
Pea Tyczynska
2019-01-08 17:52:01 +00:00
parent 848e88c7ca
commit dcc590ec96
6 changed files with 14 additions and 25 deletions

View File

@@ -34,8 +34,7 @@
link=None, link=None,
show_failures=True, show_failures=True,
smaller=False, smaller=False,
smallest=False, smallest=False
failed_as_cancelled=False
) %} ) %}
<div class="big-number-with-status"> <div class="big-number-with-status">
{{ big_number(number, label, link=link, smaller=smaller, smallest=smallest) }} {{ big_number(number, label, link=link, smaller=smaller, smallest=smallest) }}
@@ -45,26 +44,14 @@
{% if failure_link %} {% if failure_link %}
<a href="{{ failure_link }}"> <a href="{{ failure_link }}">
{{ "{:,}".format(failures) }} {{ "{:,}".format(failures) }}
{% if failed_as_cancelled %} failed {{ failure_percentage }}%
cancelled
{% else %}
failed {{ failure_percentage }}%
{% endif %}
</a> </a>
{% else %} {% else %}
{{ "{:,}".format(failures) }} {{ "{:,}".format(failures) }}
{% if failed_as_cancelled %} failed {{ failure_percentage }}%
cancelled
{% else %}
failed {{ failure_percentage }}%
{% endif %}
{% endif %} {% endif %}
{% else %} {% else %}
{% if failed_as_cancelled %} No failures
0 cancelled
{% else %}
No failures
{% endif %}
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}

View File

@@ -37,8 +37,7 @@
statistics['letter']['show_warning'], statistics['letter']['show_warning'],
failure_link=url_for(".view_notifications", service_id=service_id, message_type='letter', status='failed'), 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=''), link=url_for(".view_notifications", service_id=service_id, message_type='letter', status=''),
smaller=smaller_font_size, smaller=smaller_font_size
failed_as_cancelled=True
) }} ) }}
</div> </div>
{% endif %} {% endif %}

View File

@@ -40,7 +40,7 @@ from werkzeug.datastructures import MultiDict
SENDING_STATUSES = ['created', 'pending', 'sending', 'pending-virus-check'] SENDING_STATUSES = ['created', 'pending', 'sending', 'pending-virus-check']
DELIVERED_STATUSES = ['delivered', 'sent', 'returned-letter'] DELIVERED_STATUSES = ['delivered', 'sent', 'returned-letter']
FAILURE_STATUSES = ['failed', 'temporary-failure', 'permanent-failure', FAILURE_STATUSES = ['failed', 'temporary-failure', 'permanent-failure',
'technical-failure', 'virus-scan-failed', 'cancelled'] 'technical-failure', 'virus-scan-failed']
REQUESTED_STATUSES = SENDING_STATUSES + DELIVERED_STATUSES + FAILURE_STATUSES REQUESTED_STATUSES = SENDING_STATUSES + DELIVERED_STATUSES + FAILURE_STATUSES

View File

@@ -53,7 +53,7 @@ from tests.conftest import (
'created', 'pending', 'sending', 'pending-virus-check', 'created', 'pending', 'sending', 'pending-virus-check',
'delivered', 'sent', 'returned-letter', 'delivered', 'sent', 'returned-letter',
'failed', 'temporary-failure', 'permanent-failure', 'technical-failure', 'failed', 'temporary-failure', 'permanent-failure', 'technical-failure',
'virus-scan-failed', 'cancelled', 'virus-scan-failed',
] ]
), ),
( (
@@ -66,7 +66,7 @@ from tests.conftest import (
), ),
( (
'failed', 'failed',
['failed', 'temporary-failure', 'permanent-failure', 'technical-failure', 'virus-scan-failed', 'cancelled'] ['failed', 'temporary-failure', 'permanent-failure', 'technical-failure', 'virus-scan-failed']
) )
] ]
) )

View File

@@ -157,7 +157,7 @@ def test_jobs_page_doesnt_show_scheduled_on_page_2(
'created', 'pending', 'sending', 'pending-virus-check', 'created', 'pending', 'sending', 'pending-virus-check',
'delivered', 'sent', 'returned-letter', 'delivered', 'sent', 'returned-letter',
'failed', 'temporary-failure', 'permanent-failure', 'technical-failure', 'failed', 'temporary-failure', 'permanent-failure', 'technical-failure',
'virus-scan-failed', 'cancelled', 'virus-scan-failed',
] ]
), ),
( (
@@ -170,7 +170,7 @@ def test_jobs_page_doesnt_show_scheduled_on_page_2(
), ),
( (
'failed', 'failed',
['failed', 'temporary-failure', 'permanent-failure', 'technical-failure', 'virus-scan-failed', 'cancelled'] ['failed', 'temporary-failure', 'permanent-failure', 'technical-failure', 'virus-scan-failed']
) )
] ]
) )
@@ -340,7 +340,6 @@ def test_should_show_letter_job(
'permanent-failure', 'permanent-failure',
'technical-failure', 'technical-failure',
'virus-scan-failed', 'virus-scan-failed',
'cancelled',
], ],
) )

View File

@@ -202,7 +202,11 @@ def test_notification_page_shows_page_for_letter_notification(
), ),
( (
'validation-failed', 'validation-failed',
<<<<<<< HEAD
'Validation failed content is outside the printable area', 'Validation failed content is outside the printable area',
=======
'Cant print this letter content is outside the printable area.',
>>>>>>> Cancelled notifications do not show as failures on dashboard stats
), ),
)) ))
@freeze_time("2016-01-01 01:01") @freeze_time("2016-01-01 01:01")