From 64f356d7b04c2b6ae22ed98ed2541c990c411d94 Mon Sep 17 00:00:00 2001 From: Pea Tyczynska Date: Mon, 24 Sep 2018 11:29:33 +0100 Subject: [PATCH 1/3] Display postage on letter notification page --- app/main/views/notifications.py | 1 + app/templates/views/notifications/notification.html | 3 +++ 2 files changed, 4 insertions(+) diff --git a/app/main/views/notifications.py b/app/main/views/notifications.py index 3d2a9456b..76f65d8af 100644 --- a/app/main/views/notifications.py +++ b/app/main/views/notifications.py @@ -91,6 +91,7 @@ def view_notification(service_id, notification_id): help=get_help_argument(), estimated_letter_delivery_date=get_letter_timings(notification['created_at']).earliest_delivery, notification_id=notification['id'], + postage=notification['postage'], can_receive_inbound=(current_service.has_permission('inbound_sms')), is_precompiled_letter=notification['template']['is_precompiled_letter'] ) diff --git a/app/templates/views/notifications/notification.html b/app/templates/views/notifications/notification.html index e2aadcb46..c922a3b96 100644 --- a/app/templates/views/notifications/notification.html +++ b/app/templates/views/notifications/notification.html @@ -35,6 +35,9 @@

{% if template.template_type == 'letter' %} +

+ Sent by {{ postage }} class +

Estimated delivery date: {{ estimated_letter_delivery_date|string|format_date_short }}

From 47d047a3a88756231124f5f960b42fa935e4801f Mon Sep 17 00:00:00 2001 From: Pea Tyczynska Date: Mon, 24 Sep 2018 11:53:40 +0100 Subject: [PATCH 2/3] Add postage to fixtures and test postage display on notification page --- tests/__init__.py | 4 ++++ tests/app/main/views/test_notifications.py | 3 +++ 2 files changed, 7 insertions(+) diff --git a/tests/__init__.py b/tests/__init__.py index 6f412363e..1fc6e83db 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -369,6 +369,7 @@ def notification_json( reply_to_text=None, client_reference=None, created_by_name=None, + postage=None, ): if template is None: template = template_json(service_id, str(generate_uuid()), type_=template_type) @@ -388,6 +389,8 @@ def notification_json( if status is None: status = 'delivered' links = {} + if template_type == 'letter': + postage = 'second' if with_links: links = { @@ -415,6 +418,7 @@ def notification_json( 'service': service_id, 'template_version': template['version'], 'personalisation': personalisation or {}, + 'postage': postage, 'notification_type': template_type, 'reply_to_text': reply_to_text, 'client_reference': client_reference, diff --git a/tests/app/main/views/test_notifications.py b/tests/app/main/views/test_notifications.py index a0c133ea9..780ac0d55 100644 --- a/tests/app/main/views/test_notifications.py +++ b/tests/app/main/views/test_notifications.py @@ -157,6 +157,9 @@ def test_notification_page_shows_page_for_letter_notification( 'sample template sent by Test User on 1 January at 1:01am' ) assert normalize_spaces(page.select('main p:nth-of-type(2)')[0].text) == ( + 'Sent by second class' + ) + assert normalize_spaces(page.select('main p:nth-of-type(3)')[0].text) == ( 'Estimated delivery date: 6 January' ) assert page.select('p.notification-status') == [] From d9823850422de61682960a4ab2601120da43fcc5 Mon Sep 17 00:00:00 2001 From: Pea Tyczynska Date: Tue, 25 Sep 2018 10:42:51 +0100 Subject: [PATCH 3/3] Change wording following content review --- app/templates/views/notifications/notification.html | 2 +- tests/app/main/views/test_notifications.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/templates/views/notifications/notification.html b/app/templates/views/notifications/notification.html index c922a3b96..b7ba44d04 100644 --- a/app/templates/views/notifications/notification.html +++ b/app/templates/views/notifications/notification.html @@ -36,7 +36,7 @@ {% if template.template_type == 'letter' %}

- Sent by {{ postage }} class + Postage: {{ postage }} class

Estimated delivery date: {{ estimated_letter_delivery_date|string|format_date_short }} diff --git a/tests/app/main/views/test_notifications.py b/tests/app/main/views/test_notifications.py index 780ac0d55..3c53ebf9f 100644 --- a/tests/app/main/views/test_notifications.py +++ b/tests/app/main/views/test_notifications.py @@ -157,7 +157,7 @@ def test_notification_page_shows_page_for_letter_notification( 'sample template sent by Test User on 1 January at 1:01am' ) assert normalize_spaces(page.select('main p:nth-of-type(2)')[0].text) == ( - 'Sent by second class' + 'Postage: second class' ) assert normalize_spaces(page.select('main p:nth-of-type(3)')[0].text) == ( 'Estimated delivery date: 6 January'