Browse Source

feat: update copy and error rows

pull/2142/head
natdeanlewissoftwire 2 years ago
parent
commit
844992835c
  1. 7
      app/helpers/logs_helper.rb
  2. 4
      app/views/bulk_upload_lettings_results/deletion_report.html.erb
  3. 4
      app/views/bulk_upload_sales_results/deletion_report.html.erb

7
app/helpers/logs_helper.rb

@ -76,4 +76,11 @@ module LogsHelper
def unique_answers_to_be_cleared(bulk_upload) def unique_answers_to_be_cleared(bulk_upload)
bulk_upload.bulk_upload_errors.reject { |e| e.category == "not_answered" }.uniq(&:field) bulk_upload.bulk_upload_errors.reject { |e| e.category == "not_answered" }.uniq(&:field)
end end
def answers_to_be_deleted_title_text(bulk_upload)
unique_answers_to_be_cleared_count = unique_answers_to_be_cleared(bulk_upload).count
this_or_these = unique_answers_to_be_cleared_count == 1 ? "This" : "These"
"#{this_or_these} #{pluralize(unique_answers_to_be_cleared(@bulk_upload).count, "answer")} will be deleted if you upload the #{"log".pluralize(@bulk_upload.logs.count)}"
end
end end

4
app/views/bulk_upload_lettings_results/deletion_report.html.erb

@ -5,7 +5,7 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<span class="govuk-caption-l">Bulk upload for lettings (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Bulk upload for lettings (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l"><%= pluralize(unique_answers_to_be_cleared(@bulk_upload).count, "answer") %> will be deleted if you upload the <%= "log".pluralize(@bulk_upload.logs.count) %></h1> <h1 class="govuk-heading-l"><%= answers_to_be_deleted_title_text(@bulk_upload) %></h1>
<p>The following cells contain data this is incorrect.</p> <p>The following cells contain data this is incorrect.</p>
<p>If you upload the logs, these answers will be deleted. You will have to re-enter the data on the site and resolve these errors.</p> <p>If you upload the logs, these answers will be deleted. You will have to re-enter the data on the site and resolve these errors.</p>
@ -18,7 +18,7 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-full"> <div class="govuk-grid-column-full">
<% @bulk_upload.bulk_upload_errors.order_by_row.order_by_cell.group_by(&:row).each do |_row, errors_for_row| %> <% @bulk_upload.bulk_upload_errors.order_by_row.order_by_cell.group_by(&:row).each do |_row, errors_for_row| %>
<%= render BulkUploadErrorRowComponent.new(bulk_upload_errors: errors_for_row.reject { |e| e.category == :not_answered }) %> <%= render BulkUploadErrorRowComponent.new(bulk_upload_errors: errors_for_row.reject { |e| e.category == "not_answered" }) %>
<% end %> <% end %>
</div> </div>
</div> </div>

4
app/views/bulk_upload_sales_results/deletion_report.html.erb

@ -5,7 +5,7 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds"> <div class="govuk-grid-column-two-thirds">
<span class="govuk-caption-l">Bulk upload for sales (<%= @bulk_upload.year_combo %>)</span> <span class="govuk-caption-l">Bulk upload for sales (<%= @bulk_upload.year_combo %>)</span>
<h1 class="govuk-heading-l"><%= pluralize(unique_answers_to_be_cleared(@bulk_upload).count, "answer") %> will be deleted if you upload the <%= "log".pluralize(@bulk_upload.logs.count) %></h1> <h1 class="govuk-heading-l"><%= answers_to_be_deleted_title_text(@bulk_upload) %></h1>
<p>The following cells contain data this is incorrect.</p> <p>The following cells contain data this is incorrect.</p>
<p>If you upload the logs, these answers will be deleted. You will have to re-enter the data on the site and resolve these errors.</p> <p>If you upload the logs, these answers will be deleted. You will have to re-enter the data on the site and resolve these errors.</p>
@ -18,7 +18,7 @@
<div class="govuk-grid-row"> <div class="govuk-grid-row">
<div class="govuk-grid-column-full"> <div class="govuk-grid-column-full">
<% @bulk_upload.bulk_upload_errors.order_by_row.order_by_cell.group_by(&:row).each do |_row, errors_for_row| %> <% @bulk_upload.bulk_upload_errors.order_by_row.order_by_cell.group_by(&:row).each do |_row, errors_for_row| %>
<%= render BulkUploadErrorRowComponent.new(bulk_upload_errors: errors_for_row.reject { |e| e.category == :not_answered }) %> <%= render BulkUploadErrorRowComponent.new(bulk_upload_errors: errors_for_row.reject { |e| e.category == "not_answered" }) %>
<% end %> <% end %>
</div> </div>
</div> </div>

Loading…
Cancel
Save