Browse Source

CLDC-4141: Add final question numbers (CLDC-4202)

pull/3156/head
Samuel Young 1 week ago
parent
commit
e445e72070
  1. 4
      app/models/form/lettings/questions/lead_tenant_sex_registered_at_birth.rb
  2. 9
      app/models/form/lettings/questions/person_sex_registered_at_birth.rb
  3. 4
      spec/models/form/lettings/questions/lead_tenant_sex_registered_at_birth_spec.rb
  4. 28
      spec/models/form/lettings/questions/person_sex_registered_at_birth_spec.rb

4
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

9
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

4
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

28
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

Loading…
Cancel
Save