Fix error when file has header rows but no data

Previously the error was saying ‘It needs at least one row of data, and
columns called None’.
This commit is contained in:
Chris Hill-Scott
2017-12-20 11:59:51 +00:00
parent 5f5dd3ac41
commit eb395db2d6
2 changed files with 22 additions and 6 deletions

View File

@@ -38,12 +38,18 @@
<h1 class='banner-title' data-module="track-error" data-error-type="No rows" data-error-label="{{ upload_id }}">
Your file is missing some rows
</h1>
<p>
It needs at least one row of data, and {{ recipients.missing_column_headers | sort() | formatted_list(
prefix='a column called',
prefix_plural='columns called'
) }}.
</p>
{% if recipients.missing_column_headers %}
<p>
It needs at least one row of data, and {{ recipients.missing_column_headers | sort() | formatted_list(
prefix='a column called',
prefix_plural='columns called'
) }}.
</p>
{% else %}
<p>
It needs at least one row of data.
</p>
{% endif %}
{% elif not recipients.has_recipient_columns %}

View File

@@ -352,6 +352,16 @@ def test_upload_csvfile_with_errors_shows_check_page_with_errors(
'Skip to file contents'
)
),
(
"""
phone number, name
""",
(
'Your file is missing some rows '
'It needs at least one row of data. '
'Skip to file contents'
)
),
(
"+447700900986",
(