diff --git a/app/controllers/duplicate_logs_controller.rb b/app/controllers/duplicate_logs_controller.rb index 42a4e561d..21e853bf9 100644 --- a/app/controllers/duplicate_logs_controller.rb +++ b/app/controllers/duplicate_logs_controller.rb @@ -10,7 +10,10 @@ class DuplicateLogsController < ApplicationController current_user.sales_logs.duplicate_logs(@log) end @all_duplicates = [@log, *@duplicate_logs] - @duplicate_check_questions = duplicate_check_question_ids.map { |question_id| @log.form.get_question(question_id, @log) }.compact + @duplicate_check_questions = duplicate_check_question_ids.map { |question_id| + question = @log.form.get_question(question_id, @log) + question if question.page.routed_to?(@log, current_user) + }.compact else render_not_found end @@ -31,13 +34,14 @@ private ["owning_organisation_id", "startdate", "tenancycode", - @log.is_general_needs? ? "postcode_full" : nil, - @log.is_supported_housing? ? "location_id" : nil, + "postcode_full", + "scheme_id", + "location_id", "age1", "sex1", "ecstat1", @log.household_charge == 1 ? "household_charge" : nil, - !@log.is_carehome? && @log.household_charge != 1 ? "tcharge" : nil, + "tcharge", @log.is_carehome? ? "chcharge" : nil].compact else %w[owning_organisation_id saledate purchid age1 sex1 ecstat1 postcode_full] diff --git a/app/views/duplicate_logs/_duplicate_log_check_answers.erb b/app/views/duplicate_logs/_duplicate_log_check_answers.erb index 6d7052386..15d4caf73 100644 --- a/app/views/duplicate_logs/_duplicate_log_check_answers.erb +++ b/app/views/duplicate_logs/_duplicate_log_check_answers.erb @@ -11,6 +11,20 @@ wrapper_tag: "span", class: "govuk-!-margin-right-4", ) %> + + <% extra_value = question.get_extra_check_answer_value(@log) %> + + <% if extra_value && question.answer_label(@log, current_user).present? %> + <%= simple_format( + extra_value, + wrapper_tag: "span", + class: "govuk-!-font-weight-regular app-!-colour-muted", + ) %> + <% end %> + + <% question.get_inferred_answers(@log).each do |inferred_answer| %> + <%= inferred_answer %> + <% end %> <% end %> <% row.action( diff --git a/spec/requests/duplicate_logs_controller_spec.rb b/spec/requests/duplicate_logs_controller_spec.rb index c706f313f..3ba94c218 100644 --- a/spec/requests/duplicate_logs_controller_spec.rb +++ b/spec/requests/duplicate_logs_controller_spec.rb @@ -63,7 +63,6 @@ RSpec.describe DuplicateLogsController, type: :request do end it "displays check your answers for each log with correct questions" do - expect(page).to have_content("Q1 - Stock owner", count: 3) expect(page).to have_content("Q5 - Tenancy start date", count: 3) expect(page).to have_content("Q7 - Tenant code", count: 3) expect(page).to have_content("Q12 - Postcode", count: 3) @@ -71,7 +70,7 @@ RSpec.describe DuplicateLogsController, type: :request do expect(page).to have_content("Q33 - Lead tenant’s gender identity", count: 3) expect(page).to have_content("Q37 - Lead tenant’s working situation", count: 3) expect(page).to have_content("Household rent and charges", count: 3) - expect(page).to have_link("Change", count: 24) + expect(page).to have_link("Change", count: 21) end it "displays buttons to delete" do @@ -94,14 +93,13 @@ RSpec.describe DuplicateLogsController, type: :request do end it "displays check your answers for each log with correct questions" do - expect(page).to have_content("Owning organisation", count: 3) expect(page).to have_content("Q1 - Sale completion date", count: 3) expect(page).to have_content("Q2 - Purchaser code", count: 3) expect(page).to have_content("Q20 - Lead buyer’s age", count: 3) expect(page).to have_content("Q21 - Buyer 1’s gender identity", count: 3) expect(page).to have_content("Q25 - Buyer 1's working situation", count: 3) expect(page).to have_content("Q15 - Postcode", count: 3) - expect(page).to have_link("Change", count: 21) + expect(page).to have_link("Change", count: 18) end it "displays buttons to delete" do