From e9d230b9a48a236b33b91d1707a334799468d672 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 9 Sep 2016 15:57:05 +0100 Subject: [PATCH] Always show created time for sending state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a notification is in `created` or `sending` the thing you care about is how long it’s been sitting there. --- app/__init__.py | 8 ++++---- app/templates/components/table.html | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 08821bb56..a73b20125 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -282,11 +282,11 @@ def format_notification_status(status, template_type): }.get(template_type).get(status, status) -def format_notification_status_as_time(status, when): +def format_notification_status_as_time(status, created, updated): return { - 'sending': ' since {}'.format(when), - 'created': ' since {}'.format(when) - }.get(status, when) + 'sending': ' since {}'.format(created), + 'created': ' since {}'.format(created) + }.get(status, updated) def format_notification_status_as_field_status(status): diff --git a/app/templates/components/table.html b/app/templates/components/table.html index a97783247..97783ff93 100644 --- a/app/templates/components/table.html +++ b/app/templates/components/table.html @@ -113,6 +113,7 @@ {% endif %} {{ notification.status|format_notification_status_as_time( + notification.created_at|format_datetime_short, (notification.updated_at or notification.created_at)|format_datetime_short ) }}