Browse Source

refactor: lint

pull/2142/head
natdeanlewissoftwire 2 years ago
parent
commit
8e7d9cdb66
  1. 4
      app/helpers/logs_helper.rb
  2. 2
      app/views/bulk_upload_lettings_results/deletion_report.html.erb
  3. 1
      app/views/bulk_upload_lettings_resume/confirm.html.erb

4
app/helpers/logs_helper.rb

@ -66,10 +66,10 @@ module LogsHelper
end end
def deleted_errors_warning_text(bulk_upload) def deleted_errors_warning_text(bulk_upload)
unique_field_count = bulk_upload.bulk_upload_errors.uniq { |e| e.field }.count unique_field_count = bulk_upload.bulk_upload_errors.uniq(&:field).count
this_or_these = unique_field_count == 1 ? "this" : "these" this_or_these = unique_field_count == 1 ? "this" : "these"
it_is_or_they_are = unique_field_count == 1 ? "it is" : "they are" it_is_or_they_are = unique_field_count == 1 ? "it is" : "they are"
"#{pluralize(unique_field_count, "answer")} will be deleted because #{it_is_or_they_are} invalid. You will have to answer #{this_or_these} #{"question".pluralize(unique_field_count)} again on the site." "#{pluralize(unique_field_count, 'answer')} will be deleted because #{it_is_or_they_are} invalid. You will have to answer #{this_or_these} #{'question'.pluralize(unique_field_count)} again on the site."
end end
end end

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

@ -1,7 +1,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"><%= @bulk_upload.bulk_upload_errors.uniq { |e| e.field }.count == 1 ? "This" : "These" %> <%= pluralize(@bulk_upload.bulk_upload_errors.uniq { |e| e.field }.count, "answer") %> will be deleted if you upload the <%= "log".pluralize(@bulk_upload.logs.count) %></h1> <h1 class="govuk-heading-l"><%= @bulk_upload.bulk_upload_errors.uniq(&:field).count == 1 ? "This" : "These" %> <%= pluralize(@bulk_upload.bulk_upload_errors.uniq(&:field).count, "answer") %> will be deleted if you upload the <%= "log".pluralize(@bulk_upload.logs.count) %></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>

1
app/views/bulk_upload_lettings_resume/confirm.html.erb

@ -12,7 +12,6 @@
<%= govuk_link_to "View the error report", deletion_report_bulk_upload_lettings_result_path %> <%= govuk_link_to "View the error report", deletion_report_bulk_upload_lettings_result_path %>
</p> </p>
<%= govuk_warning_text do %> <%= govuk_warning_text do %>
<%= deleted_errors_warning_text(@bulk_upload) %> <%= deleted_errors_warning_text(@bulk_upload) %>
<%= govuk_link_to "See which answers will be deleted", deletion_report_bulk_upload_lettings_result_path %> <%= govuk_link_to "See which answers will be deleted", deletion_report_bulk_upload_lettings_result_path %>

Loading…
Cancel
Save