Error if a CSV file contains more than 50,000 rows

We want to limit the number of rows someone can have in a job, because
it gets too slow to process the file otherwise.

This should be the first error that a user sees, because we can’t work
out if there are other errors until they’ve got the file down to a
processable size.

This also means adding a message to say that the file can’t be displayed
if it doesn’t contain any processed rows.

***

https://www.pivotaltracker.com/story/show/129830161
This commit is contained in:
Chris Hill-Scott
2016-10-14 10:44:28 +01:00
parent 7ceb1cdd15
commit a32dcbf8e3
3 changed files with 58 additions and 3 deletions

View File

@@ -15,7 +15,22 @@
{% block maincolumn_content %}
{% if not recipients.has_recipient_column %}
{% if recipients.has_too_many_rows %}
<div class="bottom-gutter">
{% call banner_wrapper(type='dangerous') %}
<h1 class='banner-title'>
Your file has too many rows
</h1>
<p>
Notify can process up to
{{ "{:,}".format(recipients.max_rows) }} rows at once. Your
file has {{ "{:,}".format(recipients|length) }} rows.
</p>
{% endcall %}
</div>
{% elif not recipients.has_recipient_column %}
<div class="bottom-gutter">
{% call banner_wrapper(type='dangerous') %}
@@ -159,7 +174,8 @@
{% call(item, row_number) list_table(
recipients.initial_annotated_rows_with_errors if row_errors and not recipients.missing_column_headers else recipients.initial_annotated_rows,
caption=original_file_name,
field_headings=['1'] + recipients.column_headers
field_headings=['1'] + recipients.column_headers,
empty_message='Cant show the contents of this file'
) %}
{{ index_field(item.index + 2) }}
{% for column in recipients.column_headers %}