From e445e72070e144313c1d8b08542eb6b3765f92c2 Mon Sep 17 00:00:00 2001 From: Samuel Young Date: Mon, 9 Feb 2026 16:26:24 +0000 Subject: [PATCH] CLDC-4141: Add final question numbers (CLDC-4202) --- .../lead_tenant_sex_registered_at_birth.rb | 4 +-- .../person_sex_registered_at_birth.rb | 9 ++++-- ...ead_tenant_sex_registered_at_birth_spec.rb | 4 +++ .../person_sex_registered_at_birth_spec.rb | 28 +++++++++++++++++++ 4 files changed, 41 insertions(+), 4 deletions(-) diff --git a/app/models/form/lettings/questions/lead_tenant_sex_registered_at_birth.rb b/app/models/form/lettings/questions/lead_tenant_sex_registered_at_birth.rb index 36995333d..2e8523f51 100644 --- a/app/models/form/lettings/questions/lead_tenant_sex_registered_at_birth.rb +++ b/app/models/form/lettings/questions/lead_tenant_sex_registered_at_birth.rb @@ -5,7 +5,7 @@ class Form::Lettings::Questions::LeadTenantSexRegisteredAtBirth < ::Form::Questi @type = "radio" @check_answers_card_number = 1 @answer_options = ANSWER_OPTIONS - @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] + @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] end ANSWER_OPTIONS = { @@ -15,5 +15,5 @@ class Form::Lettings::Questions::LeadTenantSexRegisteredAtBirth < ::Form::Questi "R" => { "value" => "Lead tenant prefers not to say" }, }.freeze - QUESTION_NUMBER_FROM_YEAR = { 2026 => 0 }.freeze + QUESTION_NUMBER_FROM_YEAR = { 2026 => 31 }.freeze end diff --git a/app/models/form/lettings/questions/person_sex_registered_at_birth.rb b/app/models/form/lettings/questions/person_sex_registered_at_birth.rb index 514e9b2b5..b549885b1 100644 --- a/app/models/form/lettings/questions/person_sex_registered_at_birth.rb +++ b/app/models/form/lettings/questions/person_sex_registered_at_birth.rb @@ -4,7 +4,8 @@ class Form::Lettings::Questions::PersonSexRegisteredAtBirth < ::Form::Question @type = "radio" @check_answers_card_number = person_index @answer_options = ANSWER_OPTIONS - @question_number = QUESTION_NUMBER_FROM_YEAR[form.start_date.year] || QUESTION_NUMBER_FROM_YEAR[QUESTION_NUMBER_FROM_YEAR.keys.max] + @person_index = person_index + @question_number = question_number end ANSWER_OPTIONS = { @@ -14,5 +15,9 @@ class Form::Lettings::Questions::PersonSexRegisteredAtBirth < ::Form::Question "R" => { "value" => "Person prefers not to say" }, }.freeze - QUESTION_NUMBER_FROM_YEAR = { 2026 => 0 }.freeze + def question_number + base_question_number = 29 + + base_question_number + (5 * @person_index) + end end diff --git a/spec/models/form/lettings/questions/lead_tenant_sex_registered_at_birth_spec.rb b/spec/models/form/lettings/questions/lead_tenant_sex_registered_at_birth_spec.rb index b8064328e..bdac0ddf9 100644 --- a/spec/models/form/lettings/questions/lead_tenant_sex_registered_at_birth_spec.rb +++ b/spec/models/form/lettings/questions/lead_tenant_sex_registered_at_birth_spec.rb @@ -46,4 +46,8 @@ RSpec.describe Form::Lettings::Questions::LeadTenantSexRegisteredAtBirth, type: it "has the correct inferred_check_answers_value" do expect(question.inferred_check_answers_value).to be_nil end + + it "has the correct question number" do + expect(question.question_number).to eq(31) + end end diff --git a/spec/models/form/lettings/questions/person_sex_registered_at_birth_spec.rb b/spec/models/form/lettings/questions/person_sex_registered_at_birth_spec.rb index 8aa868c6f..90f48cfda 100644 --- a/spec/models/form/lettings/questions/person_sex_registered_at_birth_spec.rb +++ b/spec/models/form/lettings/questions/person_sex_registered_at_birth_spec.rb @@ -51,6 +51,10 @@ RSpec.describe Form::Lettings::Questions::PersonSexRegisteredAtBirth, type: :mod it "has the correct inferred_check_answers_value" do expect(question.inferred_check_answers_value).to be_nil end + + it "has the correct question number" do + expect(question.question_number).to eq(39) + end end context "when person 3" do @@ -68,6 +72,10 @@ RSpec.describe Form::Lettings::Questions::PersonSexRegisteredAtBirth, type: :mod it "has the correct inferred_check_answers_value" do expect(question.inferred_check_answers_value).to be_nil end + + it "has the correct question number" do + expect(question.question_number).to eq(44) + end end context "when person 4" do @@ -85,6 +93,10 @@ RSpec.describe Form::Lettings::Questions::PersonSexRegisteredAtBirth, type: :mod it "has the correct inferred_check_answers_value" do expect(question.inferred_check_answers_value).to be_nil end + + it "has the correct question number" do + expect(question.question_number).to eq(49) + end end context "when person 5" do @@ -102,6 +114,10 @@ RSpec.describe Form::Lettings::Questions::PersonSexRegisteredAtBirth, type: :mod it "has the correct inferred_check_answers_value" do expect(question.inferred_check_answers_value).to be_nil end + + it "has the correct question number" do + expect(question.question_number).to eq(54) + end end context "when person 6" do @@ -119,6 +135,10 @@ RSpec.describe Form::Lettings::Questions::PersonSexRegisteredAtBirth, type: :mod it "has the correct inferred_check_answers_value" do expect(question.inferred_check_answers_value).to be_nil end + + it "has the correct question number" do + expect(question.question_number).to eq(59) + end end context "when person 7" do @@ -136,6 +156,10 @@ RSpec.describe Form::Lettings::Questions::PersonSexRegisteredAtBirth, type: :mod it "has the correct inferred_check_answers_value" do expect(question.inferred_check_answers_value).to be_nil end + + it "has the correct question number" do + expect(question.question_number).to eq(64) + end end context "when person 8" do @@ -153,5 +177,9 @@ RSpec.describe Form::Lettings::Questions::PersonSexRegisteredAtBirth, type: :mod it "has the correct inferred_check_answers_value" do expect(question.inferred_check_answers_value).to be_nil end + + it "has the correct question number" do + expect(question.question_number).to eq(69) + end end end