Browse Source

CLDC-3280: Remove error report upload again when viewing before decision (#3303)

* CLDC-3280: Add back link to error summary page

* CLDC-3280: Hide upload button if navigating from a view url

* CLDC-3280: Update tests

* CLDC-3280: Make read only error report opt-in

this means we can be happy only the touched pages will have a change in behaviour

* CLDC-3280: Rename fix errors in tests to reupload file

Co-authored-by: Oscar Richardson <116292912+oscar-richardson-softwire@users.noreply.github.com>

---------

Co-authored-by: Oscar Richardson <116292912+oscar-richardson-softwire@users.noreply.github.com>
pull/3319/merge
Samuel Young 1 day ago committed by GitHub
parent
commit
13b2fc61c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      app/models/forms/bulk_upload_resume/confirm.rb
  2. 6
      app/models/forms/bulk_upload_resume/fix_choice.rb
  3. 4
      app/views/bulk_upload_lettings_results/show.html.erb
  4. 8
      app/views/bulk_upload_lettings_results/summary.html.erb
  5. 2
      app/views/bulk_upload_lettings_resume/confirm.html.erb
  6. 2
      app/views/bulk_upload_lettings_resume/fix_choice.html.erb
  7. 4
      app/views/bulk_upload_sales_results/show.html.erb
  8. 8
      app/views/bulk_upload_sales_results/summary.html.erb
  9. 2
      app/views/bulk_upload_sales_resume/confirm.html.erb
  10. 2
      app/views/bulk_upload_sales_resume/fix_choice.html.erb
  11. 36
      spec/requests/bulk_upload_lettings_results_controller_spec.rb
  12. 36
      spec/requests/bulk_upload_sales_results_controller_spec.rb

6
app/models/forms/bulk_upload_resume/confirm.rb

@ -20,11 +20,11 @@ module Forms
send("resume_bulk_upload_#{log_type}_result_path", bulk_upload)
end
def error_report_path
def error_report_path(read_only: false)
if BulkUploadErrorSummaryTableComponent.new(bulk_upload:).errors?
send("summary_bulk_upload_#{log_type}_result_path", bulk_upload)
send("summary_bulk_upload_#{log_type}_result_path", bulk_upload, hide_upload_button: read_only ? "true" : nil)
else
send("bulk_upload_#{log_type}_result_path", bulk_upload)
send("bulk_upload_#{log_type}_result_path", bulk_upload, hide_upload_button: read_only ? "true" : nil)
end
end

6
app/models/forms/bulk_upload_resume/fix_choice.rb

@ -34,11 +34,11 @@ module Forms
end
end
def error_report_path
def error_report_path(read_only: false)
if BulkUploadErrorSummaryTableComponent.new(bulk_upload:).errors?
send("summary_bulk_upload_#{log_type}_result_path", bulk_upload)
send("summary_bulk_upload_#{log_type}_result_path", bulk_upload, hide_upload_button: read_only ? "true" : nil)
else
send("bulk_upload_#{log_type}_result_path", bulk_upload)
send("bulk_upload_#{log_type}_result_path", bulk_upload, hide_upload_button: read_only ? "true" : nil)
end
end

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

@ -33,4 +33,6 @@
</div>
</div>
<%= govuk_button_link_to "Upload your file again", start_bulk_upload_lettings_logs_path(organisation_id: @bulk_upload.organisation_id) %>
<% if params[:hide_upload_button] != "true" %>
<%= govuk_button_link_to "Upload your file again", start_bulk_upload_lettings_logs_path(organisation_id: @bulk_upload.organisation_id) %>
<% end %>

8
app/views/bulk_upload_lettings_results/summary.html.erb

@ -1,3 +1,7 @@
<% content_for :before_content do %>
<%= govuk_back_link(href: :back) %>
<% end %>
<%= render partial: "bulk_upload_shared/moved_user_banner" %>
<div class="govuk-grid-row">
@ -34,4 +38,6 @@
<% end %>
</div>
<%= govuk_button_link_to "Upload your file again", start_bulk_upload_lettings_logs_path(organisation_id: @bulk_upload.organisation_id) %>
<% if params[:hide_upload_button] != "true" %>
<%= govuk_button_link_to "Upload your file again", start_bulk_upload_lettings_logs_path(organisation_id: @bulk_upload.organisation_id) %>
<% end %>

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

@ -9,7 +9,7 @@
<p class="govuk-body">
<%= logs_and_errors_warning(@bulk_upload) %>
<%= govuk_link_to "View the error report", @form.error_report_path %>
<%= govuk_link_to "View the error report", @form.error_report_path(read_only: true) %>
</p>
<% if unique_answers_to_be_cleared(@bulk_upload).present? %>

2
app/views/bulk_upload_lettings_resume/fix_choice.html.erb

@ -19,7 +19,7 @@
</div>
<div class="govuk-body">
<%= govuk_link_to "View the error report", @form.error_report_path %>
<%= govuk_link_to "View the error report", @form.error_report_path(read_only: true) %>
</div>
<%= govuk_details(summary_text: "How to choose between fixing errors on the CORE site or in the CSV") do %>

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

@ -33,4 +33,6 @@
</div>
</div>
<%= govuk_button_link_to "Upload your file again", start_bulk_upload_sales_logs_path(organisation_id: @bulk_upload.organisation_id) %>
<% if params[:hide_upload_button] != "true" %>
<%= govuk_button_link_to "Upload your file again", start_bulk_upload_sales_logs_path(organisation_id: @bulk_upload.organisation_id) %>
<% end %>

8
app/views/bulk_upload_sales_results/summary.html.erb

@ -1,3 +1,7 @@
<% content_for :before_content do %>
<%= govuk_back_link(href: :back) %>
<% end %>
<%= render partial: "bulk_upload_shared/moved_user_banner" %>
<div class="govuk-grid-row">
@ -34,4 +38,6 @@
<% end %>
</div>
<%= govuk_button_link_to "Upload your file again", start_bulk_upload_sales_logs_path(organisation_id: @bulk_upload.organisation_id) %>
<% if params[:hide_upload_button] != "true" %>
<%= govuk_button_link_to "Upload your file again", start_bulk_upload_sales_logs_path(organisation_id: @bulk_upload.organisation_id) %>
<% end %>

2
app/views/bulk_upload_sales_resume/confirm.html.erb

@ -9,7 +9,7 @@
<p class="govuk-body">
<%= logs_and_errors_warning(@bulk_upload) %>
<%= govuk_link_to "View the error report", @form.error_report_path %>
<%= govuk_link_to "View the error report", @form.error_report_path(read_only: true) %>
</p>
<% if unique_answers_to_be_cleared(@bulk_upload).present? %>

2
app/views/bulk_upload_sales_resume/fix_choice.html.erb

@ -19,7 +19,7 @@
</div>
<div class="govuk-body">
<%= govuk_link_to "View the error report", @form.error_report_path %>
<%= govuk_link_to "View the error report", @form.error_report_path(read_only: true) %>
</div>
<%= govuk_details(summary_text: "How to choose between fixing errors on the CORE site or in the CSV") do %>

36
spec/requests/bulk_upload_lettings_results_controller_spec.rb

@ -82,6 +82,24 @@ RSpec.describe BulkUploadLettingsResultsController, type: :request do
expect(response.body).to include("You moved to a different organisation since this file was uploaded. Upload the file again to get an accurate error report.")
end
end
context "and user has upload button shown" do
it "displays a link to reupload file" do
get "/lettings-logs/bulk-upload-results/#{bulk_upload.id}/summary"
expect(response.body).to include("Upload your file again")
expect(response.body).to include("/lettings-logs/bulk-upload-logs/start")
end
end
context "and user has upload button hidden" do
it "does not display a link to reupload file" do
get "/lettings-logs/bulk-upload-results/#{bulk_upload.id}/summary?hide_upload_button=true"
expect(response.body).not_to include("Upload your file again")
expect(response.body).not_to include("/lettings-logs/bulk-upload-logs/start")
end
end
end
end
@ -152,5 +170,23 @@ RSpec.describe BulkUploadLettingsResultsController, type: :request do
expect(response.body).to include("You moved to a different organisation since this file was uploaded. Upload the file again to get an accurate error report.")
end
end
context "and user has upload button shown" do
it "displays a link to reupload file" do
get "/lettings-logs/bulk-upload-results/#{bulk_upload.id}"
expect(response.body).to include("Upload your file again")
expect(response.body).to include("/lettings-logs/bulk-upload-logs/start")
end
end
context "and user has upload button hidden" do
it "does not display a link to reupload file" do
get "/lettings-logs/bulk-upload-results/#{bulk_upload.id}?hide_upload_button=true"
expect(response.body).not_to include("Upload your file again")
expect(response.body).not_to include("/lettings-logs/bulk-upload-logs/start")
end
end
end
end

36
spec/requests/bulk_upload_sales_results_controller_spec.rb

@ -44,6 +44,24 @@ RSpec.describe BulkUploadSalesResultsController, type: :request do
expect(response.body).to include("You moved to a different organisation since this file was uploaded. Upload the file again to get an accurate error report.")
end
end
context "and user has upload button shown" do
it "displays a link to reupload file" do
get "/sales-logs/bulk-upload-results/#{bulk_upload.id}/summary"
expect(response.body).to include("Upload your file again")
expect(response.body).to include("/sales-logs/bulk-upload-logs/start")
end
end
context "and user has upload button hidden" do
it "does not display a link to reupload file" do
get "/sales-logs/bulk-upload-results/#{bulk_upload.id}/summary?hide_upload_button=true"
expect(response.body).not_to include("Upload your file again")
expect(response.body).not_to include("/sales-logs/bulk-upload-logs/start")
end
end
end
end
@ -127,5 +145,23 @@ RSpec.describe BulkUploadSalesResultsController, type: :request do
expect(response.body).to include("You moved to a different organisation since this file was uploaded. Upload the file again to get an accurate error report.")
end
end
context "and user has upload button shown" do
it "displays a link to reupload file" do
get "/sales-logs/bulk-upload-results/#{bulk_upload.id}"
expect(response.body).to include("Upload your file again")
expect(response.body).to include("/sales-logs/bulk-upload-logs/start")
end
end
context "and user has upload button hidden" do
it "does not display a link to reupload file" do
get "/sales-logs/bulk-upload-results/#{bulk_upload.id}?hide_upload_button=true"
expect(response.body).not_to include("Upload your file again")
expect(response.body).not_to include("/sales-logs/bulk-upload-logs/start")
end
end
end
end

Loading…
Cancel
Save