diff --git a/app/models/form/lettings/pages/address_fallback.rb b/app/models/form/lettings/pages/address_fallback.rb index 2d5249671..763f9d3da 100644 --- a/app/models/form/lettings/pages/address_fallback.rb +++ b/app/models/form/lettings/pages/address_fallback.rb @@ -11,6 +11,7 @@ class Form::Lettings::Pages::AddressFallback < ::Form::Page { "is_supported_housing?" => false, "uprn_known" => 0, "address_options_present?" => false }, { "is_supported_housing?" => false, "uprn_confirmed" => 0, "address_options_present?" => false }, ] + @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] end def questions @@ -22,4 +23,6 @@ class Form::Lettings::Pages::AddressFallback < ::Form::Page Form::Lettings::Questions::PostcodeForFullAddress.new(nil, nil, self), ] end + + QUESTION_NUMBER_FROM_YEAR = { 2024 => 13, 2025 => 13 }.freeze end diff --git a/app/models/form/page.rb b/app/models/form/page.rb index c1c09c362..6aa93d766 100644 --- a/app/models/form/page.rb +++ b/app/models/form/page.rb @@ -1,7 +1,7 @@ class Form::Page attr_accessor :id, :header_partial, :description, :questions, :depends_on, :title_text, :informative_text, :subsection, :hide_subsection_label, :next_unresolved_page_id, - :skip_text, :interruption_screen_question_ids, :submit_text + :skip_text, :interruption_screen_question_ids, :submit_text, :question_number def initialize(id, hsh, subsection) @id = id @@ -11,6 +11,7 @@ class Form::Page @header_partial = hsh["header_partial"] @description = hsh["description"] @questions = hsh["questions"].map { |q_id, q| Form::Question.new(q_id, q, self) } + @question_number = hsh["question_number"] @depends_on = hsh["depends_on"] @title_text = hsh["title_text"] @informative_text = hsh["informative_text"] diff --git a/app/models/form/sales/pages/address_fallback.rb b/app/models/form/sales/pages/address_fallback.rb index 1f0a3f1e8..b6818ae0c 100644 --- a/app/models/form/sales/pages/address_fallback.rb +++ b/app/models/form/sales/pages/address_fallback.rb @@ -11,6 +11,7 @@ class Form::Sales::Pages::AddressFallback < ::Form::Page { "uprn_known" => 0, "address_options_present?" => false }, { "uprn_confirmed" => 0, "address_options_present?" => false }, ] + @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] end def questions @@ -22,4 +23,6 @@ class Form::Sales::Pages::AddressFallback < ::Form::Page Form::Sales::Questions::PostcodeForFullAddress.new(nil, nil, self), ] end + + QUESTION_NUMBER_FROM_YEAR = { 2024 => 16, 2025 => 16 }.freeze end diff --git a/app/views/form/page.html.erb b/app/views/form/page.html.erb index 1d4f0e7a1..42097c4e6 100644 --- a/app/views/form/page.html.erb +++ b/app/views/form/page.html.erb @@ -27,7 +27,7 @@ <% if @page.header_partial.present? %> <%= render partial: "form/headers/#{@page.header_partial}", locals: { log: @log } %> <% else %> - <%= @page.header %> + <%= @page.question_number ? "Q#{@page.question_number} - #{@page.header}" : @page.header %> <% end %> <% end %> diff --git a/config/locales/forms/2024/lettings/property_information.en.yml b/config/locales/forms/2024/lettings/property_information.en.yml index 383a788ce..9e7326040 100644 --- a/config/locales/forms/2024/lettings/property_information.en.yml +++ b/config/locales/forms/2024/lettings/property_information.en.yml @@ -51,7 +51,7 @@ en: question_text: "Select the correct address" address: - page_header: "Q12 - What is the property's address?" + page_header: "What is the property's address?" address_line1: check_answer_label: "Address lines 1 and 2" check_answer_prompt: "Enter address lines 1 and 2" diff --git a/config/locales/forms/2024/sales/property_information.en.yml b/config/locales/forms/2024/sales/property_information.en.yml index dd9a04240..b40e40267 100644 --- a/config/locales/forms/2024/sales/property_information.en.yml +++ b/config/locales/forms/2024/sales/property_information.en.yml @@ -44,7 +44,7 @@ en: question_text: "Select the correct address" address: - page_header: "Q12 - What is the property's address?" + page_header: "What is the property's address?" address_line1: check_answer_label: "Address lines 1 and 2" check_answer_prompt: "Enter address lines 1 and 2" diff --git a/config/locales/forms/2025/lettings/property_information.en.yml b/config/locales/forms/2025/lettings/property_information.en.yml index 71a2b6124..65c6c0cca 100644 --- a/config/locales/forms/2025/lettings/property_information.en.yml +++ b/config/locales/forms/2025/lettings/property_information.en.yml @@ -51,7 +51,7 @@ en: question_text: "Select the correct address" address: - page_header: "Q12 - What is the property's address?" + page_header: "What is the property's address?" address_line1: check_answer_label: "Address lines 1 and 2" check_answer_prompt: "Enter address lines 1 and 2" diff --git a/config/locales/forms/2025/sales/property_information.en.yml b/config/locales/forms/2025/sales/property_information.en.yml index 96c227b3c..332219a6b 100644 --- a/config/locales/forms/2025/sales/property_information.en.yml +++ b/config/locales/forms/2025/sales/property_information.en.yml @@ -44,7 +44,7 @@ en: question_text: "Select the correct address" address: - page_header: "Q12 - What is the property's address?" + page_header: "What is the property's address?" address_line1: check_answer_label: "Address lines 1 and 2" check_answer_prompt: "Enter address lines 1 and 2" diff --git a/spec/features/sales_log_spec.rb b/spec/features/sales_log_spec.rb index b94ecd464..3030d6d6a 100644 --- a/spec/features/sales_log_spec.rb +++ b/spec/features/sales_log_spec.rb @@ -228,6 +228,30 @@ RSpec.describe "Sales Log Features" do expect(page).to have_current_path("/sales-logs/csv-download?codes_only=false&search=1") end end + + context "when displaying the question number in the page header" do + let(:sales_log) { FactoryBot.create(:sales_log, :shared_ownership_setup_complete, jointpur: 2, owning_organisation: user.organisation, assigned_to: user) } + + context "when visiting the address page" do + before do + visit("/sales-logs/#{sales_log.id}/address") + end + + it "displays the question number in the page header" do + expect(page).to have_content("Q16") + end + end + + context "when visiting the about staircasing page" do + before do + visit("/sales-logs/#{sales_log.id}/about-staircasing-not-joint-purchase") + end + + it "displays the question number in the page header" do + expect(page).to have_content(/Shared ownership scheme\s*About the staircasing transaction/) + end + end + end end end