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 e5b5388ab..3b4c4978a 100644 --- a/app/components/check_answers_summary_list_card_component.html.erb +++ b/app/components/check_answers_summary_list_card_component.html.erb @@ -10,7 +10,7 @@ <%= govuk_summary_list do |summary_list| %> <% applicable_questions.each do |question| %> <% summary_list.row do |row| %> - <% row.key { question.check_answer_label.to_s.presence || question.header.to_s } %> + <% row.key { get_question_label(question) } %> <% row.value do %> <%= get_answer_label(question) %> diff --git a/app/components/check_answers_summary_list_card_component.rb b/app/components/check_answers_summary_list_card_component.rb index e8ed971bc..c63743977 100644 --- a/app/components/check_answers_summary_list_card_component.rb +++ b/app/components/check_answers_summary_list_card_component.rb @@ -17,6 +17,10 @@ class CheckAnswersSummaryListCardComponent < ViewComponent::Base question.answer_label(log, user).presence || unanswered_value end + def get_question_label(question) + [question.question_number_string(false), question.check_answer_label.to_s.presence || question.header.to_s].compact.join(" - ") + end + def check_answers_card_title(question) return "Lead tenant" if question.form.type == "lettings" && question.check_answers_card_number == 1 return "Buyer #{question.check_answers_card_number}" if question.check_answers_card_number <= number_of_buyers diff --git a/app/helpers/check_answers_helper.rb b/app/helpers/check_answers_helper.rb index a29ab98d0..8cdcbe7d2 100644 --- a/app/helpers/check_answers_helper.rb +++ b/app/helpers/check_answers_helper.rb @@ -47,6 +47,6 @@ private end def get_question_label(question) - [question.question_number_string, question.check_answer_label.to_s.presence || question.header.to_s].compact.join(" - ") + [question.question_number_string(false), question.check_answer_label.to_s.presence || question.header.to_s].compact.join(" - ") end end diff --git a/app/helpers/question_view_helper.rb b/app/helpers/question_view_helper.rb index 3cfdec4c9..4f7276546 100644 --- a/app/helpers/question_view_helper.rb +++ b/app/helpers/question_view_helper.rb @@ -7,7 +7,7 @@ module QuestionViewHelper def legend(question, page_header, conditional) { - text: [question.question_number_string, question.header.html_safe].compact.join(" - "), + text: [question.question_number_string(conditional), question.header.html_safe].compact.join(" - "), size: label_size(page_header, conditional), tag: label_tag(page_header, conditional), } diff --git a/app/models/form/question.rb b/app/models/form/question.rb index dbbd534cd..b8abddd42 100644 --- a/app/models/form/question.rb +++ b/app/models/form/question.rb @@ -259,8 +259,8 @@ class Form::Question selected_answer_option_is_derived?(log) || has_inferred_check_answers_value?(log) end - def question_number_string - if @question_number + def question_number_string(conditional) + if @question_number && !conditional "Q#{@question_number}" end end diff --git a/app/models/form/sales/questions/age1.rb b/app/models/form/sales/questions/age1.rb index 94d40100f..d32083b53 100644 --- a/app/models/form/sales/questions/age1.rb +++ b/app/models/form/sales/questions/age1.rb @@ -19,5 +19,6 @@ class Form::Sales::Questions::Age1 < ::Form::Question @check_answers_card_number = 1 @min = 16 @max = 110 + @question_number = 20 end end diff --git a/app/models/form/sales/questions/age2.rb b/app/models/form/sales/questions/age2.rb index 9ba347ec8..c0dc567a1 100644 --- a/app/models/form/sales/questions/age2.rb +++ b/app/models/form/sales/questions/age2.rb @@ -13,5 +13,6 @@ class Form::Sales::Questions::Age2 < ::Form::Question @check_answers_card_number = 2 @max = 110 @min = 0 + @question_number = 28 end end diff --git a/app/models/form/sales/questions/person_age.rb b/app/models/form/sales/questions/person_age.rb index c0a3e55a8..a7e9fe092 100644 --- a/app/models/form/sales/questions/person_age.rb +++ b/app/models/form/sales/questions/person_age.rb @@ -12,5 +12,6 @@ class Form::Sales::Questions::PersonAge < ::Form::Question @check_answers_card_number = person_index @min = 0 @max = 110 + @question_number = 29 + person_index * 4 end end diff --git a/app/views/form/_textarea_question.html.erb b/app/views/form/_textarea_question.html.erb index a7ce882de..a9768e4d0 100644 --- a/app/views/form/_textarea_question.html.erb +++ b/app/views/form/_textarea_question.html.erb @@ -2,7 +2,7 @@ <%= f.govuk_text_area question.id.to_sym, caption: caption(caption_text, page_header, conditional), - label: legend(question, page_header, conditional, @log), + label: legend(question, page_header, conditional), hint: { text: question.hint_text&.html_safe }, width: question.width || nil, **stimulus_html_attributes(question) %>