From fea6f102567345b69e7d6afe7809c3da333343f8 Mon Sep 17 00:00:00 2001 From: Kat Date: Mon, 8 Jul 2024 11:10:34 +0100 Subject: [PATCH] Update correct_validation_action_href --- .../check_answers_summary_list_card_component.html.erb | 2 +- app/components/check_answers_summary_list_card_component.rb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/components/check_answers_summary_list_card_component.html.erb b/app/components/check_answers_summary_list_card_component.html.erb index 4f3df47fa..4c1f9aa2d 100644 --- a/app/components/check_answers_summary_list_card_component.html.erb +++ b/app/components/check_answers_summary_list_card_component.html.erb @@ -36,7 +36,7 @@ <% if @log.collection_period_open_for_editing? %> <% row.with_action( text: question.action_text(log, correcting_hard_validation: @correcting_hard_validation), - href: @correcting_hard_validation ? correct_validation_action_href(question, log, applicable_questions.map(&:id)) : action_href(question, log), + href: correct_validation_action_href(question, log, applicable_questions.map(&:id), @correcting_hard_validation), visually_hidden_text: question.check_answer_label.to_s.downcase, ) %> <% end %> diff --git a/app/components/check_answers_summary_list_card_component.rb b/app/components/check_answers_summary_list_card_component.rb index f229b76d4..5242c7f41 100644 --- a/app/components/check_answers_summary_list_card_component.rb +++ b/app/components/check_answers_summary_list_card_component.rb @@ -34,7 +34,9 @@ class CheckAnswersSummaryListCardComponent < ViewComponent::Base send("#{log.model_name.param_key}_#{question.page.id}_path", log, referrer:) end - def correct_validation_action_href(question, log, _related_question_ids) + def correct_validation_action_href(question, log, _related_question_ids, correcting_hard_validation) + return action_href(question, log) unless correcting_hard_validation + if question.displayed_as_answered?(log) send("#{log.model_name.param_key}_confirm_clear_answer_path", log, question_id: question.id) else