From c59142b871c838383d8bc82e111045d7a7bf2a50 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Tue, 11 Sep 2018 13:46:33 +0100 Subject: [PATCH] =?UTF-8?q?Map=20=E2=80=98pending=E2=80=99=20status=20to?= =?UTF-8?q?=20=E2=80=98sending=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For some reason we are getting pending back as a status from one of our text message providers. Because this is unrecognised by the admin app it shows up in the list of messages as the raw status, styled like an error. This commit maps it to sending instead, because the user doesn’t need to know or care about the difference. --- app/__init__.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index a244407d6..17588188f 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -372,6 +372,7 @@ def format_notification_status(status, template_type): 'delivered': 'Delivered', 'sending': 'Sending', 'created': 'Sending', + 'pending': 'Sending', 'sent': 'Sent internationally' }, 'letter': { @@ -391,10 +392,9 @@ def format_notification_status(status, template_type): def format_notification_status_as_time(status, created, updated): - return { - 'sending': ' since {}'.format(created), - 'created': ' since {}'.format(created) - }.get(status, updated) + return dict.fromkeys( + {'created', 'pending', 'sending'}, ' since {}'.format(created) + ).get(status, updated) def format_notification_status_as_field_status(status, notification_type): @@ -423,7 +423,8 @@ def format_notification_status_as_field_status(status, notification_type): 'delivered': None, 'sent': None, 'sending': 'default', - 'created': 'default' + 'created': 'default', + 'pending': 'default', } ).get(status, 'error')