From 6995ddc8f5a71a5af8d4bafaebe34713718ac530 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 10 Nov 2017 10:10:34 +0000 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20list=20all=20letter=20address?= =?UTF-8?q?=20cols=20if=20some=20missing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If you’ve spelt ‘postcode’ wrong, or missed only ‘address_line_2’ then it’s pretty noisy to be told that your file needs columns called address line 1, address line 2, and postcode. It’s better to be specific about which column you need to fix in order to get past this error. As a principle, we’ve found it better to tell get people to fix one error at a time, rather than overwhelm them with a list of errors to correct – this is why we split the recipient column errors out separately in the first place. --- app/templates/views/check/column-errors.html | 5 ++++- tests/app/main/views/test_send.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/templates/views/check/column-errors.html b/app/templates/views/check/column-errors.html index 4b3d788ae..553449600 100644 --- a/app/templates/views/check/column-errors.html +++ b/app/templates/views/check/column-errors.html @@ -48,7 +48,10 @@ {% elif not recipients.has_recipient_columns %}

- Your file needs {{ required_recipient_columns | formatted_list( + Your file needs {{ ( + recipients.missing_column_headers + if template.template_type == 'letter' else required_recipient_columns + ) | formatted_list( prefix='a column called', prefix_plural='columns called' ) }} diff --git a/tests/app/main/views/test_send.py b/tests/app/main/views/test_send.py index 33363bd60..7b9cb45ec 100644 --- a/tests/app/main/views/test_send.py +++ b/tests/app/main/views/test_send.py @@ -1883,7 +1883,7 @@ def test_check_messages_column_error_doesnt_show_optional_columns( ) assert normalize_spaces(page.select_one('.banner-dangerous').text) == ( - 'Your file needs columns called ‘address line 1’, ‘address line 2’ and ‘postcode’ ' + 'Your file needs a column called ‘postcode’ ' 'Right now it has columns called ‘address_line_1’, ‘address_line_2’ and ‘foo’. ' 'Skip to file contents' )