mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 14:29:51 -04:00
Display cancelled letters show as failed
In the long term, we don't want to show cancelled letters. But for now, this changes cancelled letters to display in the same way that letters with a status of permanent-failure, since we are currently giving letters that we want to cancel the status of permanent failure.
This commit is contained in:
@@ -373,6 +373,7 @@ def format_notification_status(status, template_type):
|
||||
'pending-virus-check': 'Pending virus check',
|
||||
'virus-scan-failed': 'Virus detected',
|
||||
'returned-letter': 'Delivered',
|
||||
'cancelled': 'Cancelled,'
|
||||
}
|
||||
}[template_type].get(status, status)
|
||||
|
||||
@@ -398,6 +399,7 @@ def format_notification_status_as_field_status(status, notification_type):
|
||||
'pending-virus-check': None,
|
||||
'virus-scan-failed': 'error',
|
||||
'returned-letter': None,
|
||||
'cancelled': 'error',
|
||||
}
|
||||
}.get(
|
||||
notification_type,
|
||||
|
||||
@@ -25,7 +25,8 @@ class JobApiClient(NotifyAdminAPIClient):
|
||||
def __convert_statistics(job):
|
||||
results = defaultdict(int)
|
||||
for outcome in job['statistics']:
|
||||
if outcome['status'] in ['failed', 'technical-failure', 'temporary-failure', 'permanent-failure']:
|
||||
if outcome['status'] in ['failed', 'technical-failure', 'temporary-failure',
|
||||
'permanent-failure', 'cancelled']:
|
||||
results['failed'] += outcome['count']
|
||||
if outcome['status'] in ['sending', 'pending', 'created']:
|
||||
results['sending'] += outcome['count']
|
||||
|
||||
@@ -162,7 +162,7 @@
|
||||
notification.template.template_type
|
||||
) }}
|
||||
{% endif %}
|
||||
{% if notification.notification_type == "letter" and notification.status in ['permanent-failure', 'validation-failed'] %}
|
||||
{% if notification.notification_type == "letter" and notification.status in ['permanent-failure', 'validation-failed', 'cancelled'] %}
|
||||
Cancelled
|
||||
{% endif %}
|
||||
{% if notification.status|format_notification_status_as_url(notification.notification_type) %}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
</p>
|
||||
|
||||
{% if template.template_type == 'letter' %}
|
||||
{% if notification_status == 'permanent-failure' %}
|
||||
{% if notification_status in ('permanent-failure', 'cancelled') %}
|
||||
<p class="notification-status-cancelled">
|
||||
Cancelled {{ updated_at|format_datetime_short }}
|
||||
</p>
|
||||
|
||||
@@ -39,7 +39,8 @@ 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']
|
||||
FAILURE_STATUSES = ['failed', 'temporary-failure', 'permanent-failure',
|
||||
'technical-failure', 'virus-scan-failed', 'cancelled']
|
||||
REQUESTED_STATUSES = SENDING_STATUSES + DELIVERED_STATUSES + FAILURE_STATUSES
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user