From c4c180b98481147d1c753b729512205f09cdcc03 Mon Sep 17 00:00:00 2001 From: Kat Date: Mon, 27 Feb 2023 09:10:12 +0000 Subject: [PATCH] Number person questions --- .../lettings/questions/person_relationship.rb | 17 ++++++++++++++++- app/models/form/sales/questions/person_age.rb | 17 ++++++++++++++++- .../sales/questions/person_gender_identity.rb | 17 ++++++++++++++++- .../sales/questions/person_working_situation.rb | 17 ++++++++++++++++- .../form/sales/questions/person_age_spec.rb | 2 +- .../questions/person_gender_identity_spec.rb | 8 ++++---- .../questions/person_working_situation_spec.rb | 8 ++++---- 7 files changed, 73 insertions(+), 13 deletions(-) diff --git a/app/models/form/lettings/questions/person_relationship.rb b/app/models/form/lettings/questions/person_relationship.rb index debb14a03..20e9f70ee 100644 --- a/app/models/form/lettings/questions/person_relationship.rb +++ b/app/models/form/lettings/questions/person_relationship.rb @@ -3,7 +3,7 @@ class Form::Lettings::Questions::PersonRelationship < ::Form::Question super(id, hsh, page) @id = "relat#{person_index}" @check_answer_label = "Person #{person_index}’s relationship to the lead tenant" - @header = "What is person #{person_index}’s relationship to the lead tenant?" + @header = "#{question_number(person_index)} - What is person #{person_index}’s relationship to the lead tenant?" @type = "radio" @check_answers_card_number = person_index @hint_text = "" @@ -20,4 +20,19 @@ class Form::Lettings::Questions::PersonRelationship < ::Form::Question "divider" => { "value" => true }, "R" => { "value" => "Person prefers not to say" }, }.freeze + + def question_number(person_index) + case person_index + when 2 + "Q36" + when 3 + "Q40" + when 4 + "Q44" + when 5 + "Q48" + when 6 + "Q52" + end + end end diff --git a/app/models/form/sales/questions/person_age.rb b/app/models/form/sales/questions/person_age.rb index c0a3e55a8..be1dac0c0 100644 --- a/app/models/form/sales/questions/person_age.rb +++ b/app/models/form/sales/questions/person_age.rb @@ -2,7 +2,7 @@ class Form::Sales::Questions::PersonAge < ::Form::Question def initialize(id, hsh, page, person_index:) super(id, hsh, page) @check_answer_label = "Person #{person_index}’s age" - @header = "Age" + @header = "#{question_number(person_index)} - Age" @type = "numeric" @width = 3 @inferred_check_answers_value = [{ @@ -13,4 +13,19 @@ class Form::Sales::Questions::PersonAge < ::Form::Question @min = 0 @max = 110 end + + def question_number(person_index) + case person_index + when 2 + "Q37" + when 3 + "Q41" + when 4 + "Q45" + when 5 + "Q49" + when 6 + "Q53" + end + end end diff --git a/app/models/form/sales/questions/person_gender_identity.rb b/app/models/form/sales/questions/person_gender_identity.rb index 01967e737..9c7ac0075 100644 --- a/app/models/form/sales/questions/person_gender_identity.rb +++ b/app/models/form/sales/questions/person_gender_identity.rb @@ -2,7 +2,7 @@ class Form::Sales::Questions::PersonGenderIdentity < ::Form::Question def initialize(id, hsh, page, person_index:) super(id, hsh, page) @check_answer_label = "Person #{person_index}’s gender identity" - @header = "Which of these best describes Person #{person_index}’s gender identity?" + @header = "#{question_number(person_index)} - Which of these best describes Person #{person_index}’s gender identity?" @type = "radio" @answer_options = ANSWER_OPTIONS @check_answers_card_number = person_index @@ -20,4 +20,19 @@ class Form::Sales::Questions::PersonGenderIdentity < ::Form::Question "X" => { "value" => "Non-binary" }, "R" => { "value" => "Person prefers not to say" }, }.freeze + + def question_number(person_index) + case person_index + when 2 + "Q38" + when 3 + "Q42" + when 4 + "Q46" + when 5 + "Q50" + when 6 + "Q54" + end + end end diff --git a/app/models/form/sales/questions/person_working_situation.rb b/app/models/form/sales/questions/person_working_situation.rb index 0740541b3..5fd38390e 100644 --- a/app/models/form/sales/questions/person_working_situation.rb +++ b/app/models/form/sales/questions/person_working_situation.rb @@ -2,7 +2,7 @@ class Form::Sales::Questions::PersonWorkingSituation < ::Form::Question def initialize(id, hsh, page, person_index:) super(id, hsh, page) @check_answer_label = "Person #{person_index}’s working situation" - @header = "Which of these best describes Person #{person_index}’s working situation?" + @header = "#{question_number(person_index)} - Which of these best describes Person #{person_index}’s working situation?" @type = "radio" @answer_options = ANSWER_OPTIONS @check_answers_card_number = person_index @@ -27,4 +27,19 @@ class Form::Sales::Questions::PersonWorkingSituation < ::Form::Question "7" => { "value" => "Full-time student" }, "9" => { "value" => "Child under 16" }, }.freeze + + def question_number(person_index) + case person_index + when 2 + "Q39" + when 3 + "Q43" + when 4 + "Q47" + when 5 + "Q51" + when 6 + "Q55" + end + end end diff --git a/spec/models/form/sales/questions/person_age_spec.rb b/spec/models/form/sales/questions/person_age_spec.rb index 9f475f6b6..eb2861cd1 100644 --- a/spec/models/form/sales/questions/person_age_spec.rb +++ b/spec/models/form/sales/questions/person_age_spec.rb @@ -13,7 +13,7 @@ RSpec.describe Form::Sales::Questions::PersonAge, type: :model do end it "has the correct header" do - expect(question.header).to eq("Age") + expect(question.header).to eq("Q37 - Age") end it "has the correct type" do diff --git a/spec/models/form/sales/questions/person_gender_identity_spec.rb b/spec/models/form/sales/questions/person_gender_identity_spec.rb index 0ae959e82..fd95c441a 100644 --- a/spec/models/form/sales/questions/person_gender_identity_spec.rb +++ b/spec/models/form/sales/questions/person_gender_identity_spec.rb @@ -38,7 +38,7 @@ RSpec.describe Form::Sales::Questions::PersonGenderIdentity, type: :model do end it "has the correct header" do - expect(question.header).to eq("Which of these best describes Person 2’s gender identity?") + expect(question.header).to eq("Q38 - Which of these best describes Person 2’s gender identity?") end it "has the correct check_answer_label" do @@ -65,7 +65,7 @@ RSpec.describe Form::Sales::Questions::PersonGenderIdentity, type: :model do end it "has the correct header" do - expect(question.header).to eq("Which of these best describes Person 3’s gender identity?") + expect(question.header).to eq("Q42 - Which of these best describes Person 3’s gender identity?") end it "has the correct check_answer_label" do @@ -92,7 +92,7 @@ RSpec.describe Form::Sales::Questions::PersonGenderIdentity, type: :model do end it "has the correct header" do - expect(question.header).to eq("Which of these best describes Person 4’s gender identity?") + expect(question.header).to eq("Q46 - Which of these best describes Person 4’s gender identity?") end it "has the correct check_answer_label" do @@ -119,7 +119,7 @@ RSpec.describe Form::Sales::Questions::PersonGenderIdentity, type: :model do end it "has the correct header" do - expect(question.header).to eq("Which of these best describes Person 5’s gender identity?") + expect(question.header).to eq("Q50 - Which of these best describes Person 5’s gender identity?") end it "has the correct check_answer_label" do diff --git a/spec/models/form/sales/questions/person_working_situation_spec.rb b/spec/models/form/sales/questions/person_working_situation_spec.rb index 274d199c9..7588079ad 100644 --- a/spec/models/form/sales/questions/person_working_situation_spec.rb +++ b/spec/models/form/sales/questions/person_working_situation_spec.rb @@ -45,7 +45,7 @@ RSpec.describe Form::Sales::Questions::PersonWorkingSituation, type: :model do end it "has the correct header" do - expect(question.header).to eq("Which of these best describes Person 2’s working situation?") + expect(question.header).to eq("Q39 - Which of these best describes Person 2’s working situation?") end it "has the correct check_answer_label" do @@ -72,7 +72,7 @@ RSpec.describe Form::Sales::Questions::PersonWorkingSituation, type: :model do end it "has the correct header" do - expect(question.header).to eq("Which of these best describes Person 3’s working situation?") + expect(question.header).to eq("Q43 - Which of these best describes Person 3’s working situation?") end it "has the correct check_answer_label" do @@ -99,7 +99,7 @@ RSpec.describe Form::Sales::Questions::PersonWorkingSituation, type: :model do end it "has the correct header" do - expect(question.header).to eq("Which of these best describes Person 4’s working situation?") + expect(question.header).to eq("Q47 - Which of these best describes Person 4’s working situation?") end it "has the correct check_answer_label" do @@ -126,7 +126,7 @@ RSpec.describe Form::Sales::Questions::PersonWorkingSituation, type: :model do end it "has the correct header" do - expect(question.header).to eq("Which of these best describes Person 5’s working situation?") + expect(question.header).to eq("Q51 - Which of these best describes Person 5’s working situation?") end it "has the correct check_answer_label" do