diff --git a/app/components/bulk_upload_error_summary_table_component.html.erb b/app/components/bulk_upload_error_summary_table_component.html.erb index 9cf146dc0..2f9643271 100644 --- a/app/components/bulk_upload_error_summary_table_component.html.erb +++ b/app/components/bulk_upload_error_summary_table_component.html.erb @@ -1,24 +1,16 @@ -<%= govuk_table do |table| %> - <% table.caption(size: "m", text: bulk_upload.filename) %> - - <% table.head do |head| %> - <% head.row do |row| %> - <% row.cell(text: "Column", header: true) %> - <% row.cell(text: "Number of rows", header: true) %> - <% row.cell(text: "Question", header: true) %> - <% row.cell(text: "Error", header: true) %> - <% row.cell(text: "Specification", header: true) %> - <% end %> - <% end %> +<% sorted_errors.each do |error| %> + <%= govuk_table do |table| %> + <% table.head do |head| %> + <% head.row do |row| %> + <% row.cell(text: question_for_field(error[0][1].to_sym), header: true) %> + <% row.cell(text: "Column #{error[0][0]}", header: true, numeric: true) %> + <% end %> - <% table.body do |body| %> - <% sorted_errors.each do |error| %> - <% body.row do |row| %> - <% row.cell(text: error[0][0]) %> - <% row.cell(text: error[1]) %> - <% row.cell(text: question_for_field(error[0][1].to_sym)) %> - <% row.cell(text: error[0][2]) %> - <% row.cell(text: error[0][1]) %> + <% table.body do |body| %> + <% body.row do |row| %> + <% row.cell(text: error[0][2]) %> + <% row.cell(text: pluralize(error[1], "error"), numeric: true) %> + <% end %> <% end %> <% end %> <% end %> diff --git a/app/mailers/bulk_upload_mailer.rb b/app/mailers/bulk_upload_mailer.rb index cb1fac03c..144acb3e1 100644 --- a/app/mailers/bulk_upload_mailer.rb +++ b/app/mailers/bulk_upload_mailer.rb @@ -83,7 +83,7 @@ class BulkUploadMailer < NotifyMailer .keys .sort_by { |_col, field| field } .map do |col, field| - "- Column #{col} (#{row_parser_class.question_for_field(field.to_sym)})" + "- #{row_parser_class.question_for_field(field.to_sym)} (Column #{col})" end send_email( diff --git a/app/views/bulk_upload_lettings_results/show.html.erb b/app/views/bulk_upload_lettings_results/show.html.erb index 9a8ccddec..30e0f6890 100644 --- a/app/views/bulk_upload_lettings_results/show.html.erb +++ b/app/views/bulk_upload_lettings_results/show.html.erb @@ -1,9 +1,3 @@ -<% if BulkUploadErrorSummaryTableComponent.new(bulk_upload: @bulk_upload).errors? %> - <% content_for :before_content do %> - <%= govuk_back_link(text: "Back", href: summary_bulk_upload_lettings_result_path(@bulk_upload)) %> - <% end %> -<% end %> -
- We noticed that you have a lot of similar errors for some questions. You can download the specification which we reference below to understand how to correct the data. Once you have fixed these errors you can upload again. + We could not create logs from your bulk upload. Below is a list of everything that you need to fix your spreadsheet. You can download the specification to help you fix the cells in your CSV file. +
+ ++ Filename: <%= @bulk_upload.filename %>
- You also have other errors in your file which you can either fix them in the CSV file or you can reupload and fix on CORE. <%= govuk_link_to "View the full report", bulk_upload_lettings_result_path(@bulk_upload) %> -
-+ This summary shows questions that have at least <%= BulkUploadErrorSummaryTableComponent::DISPLAY_THRESHOLD %> errors or more. See full error report for more details. +
+ + <%= render BulkUploadErrorSummaryTableComponent.new(bulk_upload: @bulk_upload) %> + <% end %> + + <% c.with_tab(label: "Full error report") do %> + <% @bulk_upload.bulk_upload_errors.group_by(&:row).each do |_row, errors_for_row| %> + <%= render BulkUploadErrorRowComponent.new(bulk_upload_errors: errors_for_row) %> + <% end %> + <% end %> + <% end %>