Update banner message for CSV letters

This was always showing the text 'Your letter has been sent...' This has
now been updated to start 'Your letters have been sent...' if a job has
more than one notification in it.
This commit is contained in:
Katie Smith
2018-11-29 11:37:38 +00:00
parent 088d6ee4b0
commit b9688f9ad3
3 changed files with 30 additions and 4 deletions

View File

@@ -93,6 +93,11 @@ def view_job(service_id, job_id):
version=job['template_version']
)['data']
just_sent_message = 'Your {} been sent. Printing starts {} at 5.30pm.'.format(
'letter has' if job['notification_count'] == 1 else 'letters have',
printing_today_or_tomorrow()
)
return render_template(
'views/jobs/job.html',
finished=(total_notifications == processed_notifications),
@@ -110,7 +115,7 @@ def view_job(service_id, job_id):
request.args.get('just_sent') == 'yes' and
template['template_type'] == 'letter'
),
printing_day=printing_today_or_tomorrow()
just_sent_message=just_sent_message,
)

View File

@@ -14,9 +14,7 @@
</h1>
{% if just_sent %}
{{ banner('Your letter has been sent. Printing starts {} at 5.30pm.'.format(printing_day),
type='default',
with_tick=True) }}
{{ banner(just_sent_message, type='default', with_tick=True) }}
{% else %}
{{ ajax_block(partials, updates_url, 'status', finished=finished) }}
{% endif %}

View File

@@ -366,6 +366,29 @@ def test_should_show_letter_job_with_banner_after_sending_before_1730(
)
@freeze_time("2016-01-01 11:09:00")
def test_should_show_letter_job_with_banner_when_there_are_multiple_CSV_rows(
client_request,
mock_get_service_letter_template,
mock_get_job_in_progress,
mock_get_notifications,
mock_get_service_data_retention_by_notification_type,
fake_uuid,
):
page = client_request.get(
'main.view_job',
service_id=SERVICE_ONE_ID,
job_id=fake_uuid,
just_sent='yes',
)
assert page.select('p.bottom-gutter') == []
assert normalize_spaces(page.select('.banner-default-with-tick')[0].text) == (
'Your letters have been sent. Printing starts today at 5.30pm.'
)
@freeze_time("2016-01-01 18:09:00")
def test_should_show_letter_job_with_banner_after_sending_after_1730(
client_request,