Don’t list all letter address cols if some missing

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.
This commit is contained in:
Chris Hill-Scott
2017-11-10 10:10:34 +00:00
parent 03447c10da
commit 6995ddc8f5
2 changed files with 5 additions and 2 deletions

View File

@@ -48,7 +48,10 @@
{% elif not recipients.has_recipient_columns %}
<h1 class='banner-title' data-module="track-error" data-error-type="Missing recipient columns" data-error-label="{{ upload_id }}">
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'
) }}

View File

@@ -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'
)