mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-06-23 17:02:01 -04:00
Only show row-level errors if all columns are OK
Row-level errors are: - bad phone number/email address - missing data I think it’s distracting to show these on the page if there’s something more fundamentally wrong with the file, eg placeholders don’t match. So this commit makes sure that these error messages are only displayed when the top-level error says ‘There is a problem with your data’
This commit is contained in:
@@ -275,7 +275,7 @@ def check_messages(service_id, template_type, upload_id):
|
||||
count_of_recipients=session['upload_data']['notification_count'],
|
||||
count_of_displayed_recipients=(
|
||||
len(list(recipients.initial_annotated_rows_with_errors))
|
||||
if any(recipients.rows_with_errors) else
|
||||
if any(recipients.rows_with_errors) and not recipients.missing_column_headers else
|
||||
len(list(recipients.initial_annotated_rows))
|
||||
),
|
||||
original_file_name=session['upload_data'].get('original_file_name'),
|
||||
|
||||
@@ -191,13 +191,13 @@
|
||||
{% endif %}
|
||||
|
||||
{% call(item, row_number) list_table(
|
||||
recipients.initial_annotated_rows_with_errors if row_errors else recipients.initial_annotated_rows,
|
||||
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
|
||||
) %}
|
||||
{{ index_field(item.index + 2) }}
|
||||
{% for column in recipients.column_headers %}
|
||||
{% if item['columns'][column].error %}
|
||||
{% if item['columns'][column].error and not recipients.missing_column_headers %}
|
||||
{% call field() %}
|
||||
<span class="table-field-error">
|
||||
<span class="table-field-error-label">{{ item['columns'][column].error }}</span>
|
||||
@@ -223,13 +223,13 @@
|
||||
|
||||
{% if count_of_displayed_recipients < count_of_recipients %}
|
||||
<p class="table-show-more-link">
|
||||
{% if row_errors %}
|
||||
{% if row_errors and not recipients.missing_column_headers %}
|
||||
Only showing the first {{ count_of_displayed_recipients }} rows with errors
|
||||
{% else %}
|
||||
Only showing the first {{ count_of_displayed_recipients }} rows
|
||||
{% endif %}
|
||||
</p>
|
||||
{% elif row_errors %}
|
||||
{% elif row_errors and not recipients.missing_column_headers %}
|
||||
<p class="table-show-more-link">
|
||||
Only showing rows with errors
|
||||
</p>
|
||||
|
||||
Reference in New Issue
Block a user