diff --git a/app/main/views/notifications.py b/app/main/views/notifications.py index 07bbb9b35..2a533bc30 100644 --- a/app/main/views/notifications.py +++ b/app/main/views/notifications.py @@ -134,6 +134,14 @@ def view_notification(service_id, notification_id): status='sending,delivered,failed', ) + if notification['notification_type'] == 'letter': + estimated_letter_delivery_date = get_letter_timings( + notification['created_at'], + postage=notification['postage'] + ).earliest_delivery + else: + estimated_letter_delivery_date = None + return render_template( 'views/notifications/notification.html', finished=(notification['status'] in (DELIVERED_STATUSES + FAILURE_STATUSES)), @@ -154,10 +162,7 @@ def view_notification(service_id, notification_id): created_at=notification['created_at'], updated_at=notification['updated_at'], help=get_help_argument(), - estimated_letter_delivery_date=get_letter_timings( - notification['created_at'], - postage=notification['postage'] - ).earliest_delivery, + estimated_letter_delivery_date=estimated_letter_delivery_date, notification_id=notification['id'], postage=notification['postage'], can_receive_inbound=(current_service.has_permission('inbound_sms')), diff --git a/requirements-app.txt b/requirements-app.txt index 80a3f30f7..30c25d2d7 100644 --- a/requirements-app.txt +++ b/requirements-app.txt @@ -23,5 +23,5 @@ notifications-python-client==5.5.1 awscli-cwlogs>=1.4,<1.5 itsdangerous==1.1.0 -git+https://github.com/alphagov/notifications-utils.git@39.3.0#egg=notifications-utils==39.3.0 +git+https://github.com/alphagov/notifications-utils.git@39.4.0#egg=notifications-utils==39.4.0 git+https://github.com/alphagov/govuk-frontend-jinja.git@v0.5.1-alpha#egg=govuk-frontend-jinja==0.5.1-alpha diff --git a/requirements.txt b/requirements.txt index f5d52fee8..836a10979 100644 --- a/requirements.txt +++ b/requirements.txt @@ -25,14 +25,14 @@ notifications-python-client==5.5.1 awscli-cwlogs>=1.4,<1.5 itsdangerous==1.1.0 -git+https://github.com/alphagov/notifications-utils.git@39.3.0#egg=notifications-utils==39.3.0 +git+https://github.com/alphagov/notifications-utils.git@39.4.0#egg=notifications-utils==39.4.0 git+https://github.com/alphagov/govuk-frontend-jinja.git@v0.5.1-alpha#egg=govuk-frontend-jinja==0.5.1-alpha ## The following requirements were added by pip freeze: -awscli==1.18.63 +awscli==1.18.66 bleach==3.1.4 boto3==1.10.38 -botocore==1.16.13 +botocore==1.16.16 certifi==2020.4.5.1 chardet==3.0.4 click==7.1.2 @@ -67,7 +67,7 @@ redis==3.5.2 requests==2.23.0 rsa==3.4.2 s3transfer==0.3.3 -six==1.14.0 +six==1.15.0 smartypants==2.0.1 statsd==3.3.0 texttable==1.6.2 diff --git a/tests/__init__.py b/tests/__init__.py index f1a8d6626..dba3573c1 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -443,8 +443,7 @@ def notification_json( if status is None: status = 'delivered' links = {} - if template_type == 'letter': - postage = postage or 'second' + postage = postage or 'second' if with_links: links = { diff --git a/tests/app/main/views/test_notifications.py b/tests/app/main/views/test_notifications.py index f4b70e642..625048c9c 100644 --- a/tests/app/main/views/test_notifications.py +++ b/tests/app/main/views/test_notifications.py @@ -530,13 +530,13 @@ def test_notification_page_does_not_show_cancel_link_for_letter_which_cannot_be_ 'europe', 'Postage: international', 'letter-postage-international', - 'Estimated delivery date: Wednesday 6 January', + 'Estimated delivery date: Friday 8 January', ), ( 'rest-of-world', 'Postage: international', 'letter-postage-international', - 'Estimated delivery date: Wednesday 6 January', + 'Estimated delivery date: Monday 11 January', ), )) @freeze_time("2016-01-01 18:00")