Browse Source

Number person questions

CLDC-1864-question-numbering
Kat 2 years ago
parent
commit
c4c180b984
  1. 17
      app/models/form/lettings/questions/person_relationship.rb
  2. 17
      app/models/form/sales/questions/person_age.rb
  3. 17
      app/models/form/sales/questions/person_gender_identity.rb
  4. 17
      app/models/form/sales/questions/person_working_situation.rb
  5. 2
      spec/models/form/sales/questions/person_age_spec.rb
  6. 8
      spec/models/form/sales/questions/person_gender_identity_spec.rb
  7. 8
      spec/models/form/sales/questions/person_working_situation_spec.rb

17
app/models/form/lettings/questions/person_relationship.rb

@ -3,7 +3,7 @@ class Form::Lettings::Questions::PersonRelationship < ::Form::Question
super(id, hsh, page) super(id, hsh, page)
@id = "relat#{person_index}" @id = "relat#{person_index}"
@check_answer_label = "Person #{person_index}’s relationship to the lead tenant" @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" @type = "radio"
@check_answers_card_number = person_index @check_answers_card_number = person_index
@hint_text = "" @hint_text = ""
@ -20,4 +20,19 @@ class Form::Lettings::Questions::PersonRelationship < ::Form::Question
"divider" => { "value" => true }, "divider" => { "value" => true },
"R" => { "value" => "Person prefers not to say" }, "R" => { "value" => "Person prefers not to say" },
}.freeze }.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 end

17
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:) def initialize(id, hsh, page, person_index:)
super(id, hsh, page) super(id, hsh, page)
@check_answer_label = "Person #{person_index}’s age" @check_answer_label = "Person #{person_index}’s age"
@header = "Age" @header = "#{question_number(person_index)} - Age"
@type = "numeric" @type = "numeric"
@width = 3 @width = 3
@inferred_check_answers_value = [{ @inferred_check_answers_value = [{
@ -13,4 +13,19 @@ class Form::Sales::Questions::PersonAge < ::Form::Question
@min = 0 @min = 0
@max = 110 @max = 110
end 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 end

17
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:) def initialize(id, hsh, page, person_index:)
super(id, hsh, page) super(id, hsh, page)
@check_answer_label = "Person #{person_index}’s gender identity" @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" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@check_answers_card_number = person_index @check_answers_card_number = person_index
@ -20,4 +20,19 @@ class Form::Sales::Questions::PersonGenderIdentity < ::Form::Question
"X" => { "value" => "Non-binary" }, "X" => { "value" => "Non-binary" },
"R" => { "value" => "Person prefers not to say" }, "R" => { "value" => "Person prefers not to say" },
}.freeze }.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 end

17
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:) def initialize(id, hsh, page, person_index:)
super(id, hsh, page) super(id, hsh, page)
@check_answer_label = "Person #{person_index}’s working situation" @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" @type = "radio"
@answer_options = ANSWER_OPTIONS @answer_options = ANSWER_OPTIONS
@check_answers_card_number = person_index @check_answers_card_number = person_index
@ -27,4 +27,19 @@ class Form::Sales::Questions::PersonWorkingSituation < ::Form::Question
"7" => { "value" => "Full-time student" }, "7" => { "value" => "Full-time student" },
"9" => { "value" => "Child under 16" }, "9" => { "value" => "Child under 16" },
}.freeze }.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 end

2
spec/models/form/sales/questions/person_age_spec.rb

@ -13,7 +13,7 @@ RSpec.describe Form::Sales::Questions::PersonAge, type: :model do
end end
it "has the correct header" do it "has the correct header" do
expect(question.header).to eq("Age") expect(question.header).to eq("Q37 - Age")
end end
it "has the correct type" do it "has the correct type" do

8
spec/models/form/sales/questions/person_gender_identity_spec.rb

@ -38,7 +38,7 @@ RSpec.describe Form::Sales::Questions::PersonGenderIdentity, type: :model do
end end
it "has the correct header" do 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 end
it "has the correct check_answer_label" do it "has the correct check_answer_label" do
@ -65,7 +65,7 @@ RSpec.describe Form::Sales::Questions::PersonGenderIdentity, type: :model do
end end
it "has the correct header" do 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 end
it "has the correct check_answer_label" do it "has the correct check_answer_label" do
@ -92,7 +92,7 @@ RSpec.describe Form::Sales::Questions::PersonGenderIdentity, type: :model do
end end
it "has the correct header" do 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 end
it "has the correct check_answer_label" do it "has the correct check_answer_label" do
@ -119,7 +119,7 @@ RSpec.describe Form::Sales::Questions::PersonGenderIdentity, type: :model do
end end
it "has the correct header" do 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 end
it "has the correct check_answer_label" do it "has the correct check_answer_label" do

8
spec/models/form/sales/questions/person_working_situation_spec.rb

@ -45,7 +45,7 @@ RSpec.describe Form::Sales::Questions::PersonWorkingSituation, type: :model do
end end
it "has the correct header" do 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 end
it "has the correct check_answer_label" do it "has the correct check_answer_label" do
@ -72,7 +72,7 @@ RSpec.describe Form::Sales::Questions::PersonWorkingSituation, type: :model do
end end
it "has the correct header" do 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 end
it "has the correct check_answer_label" do it "has the correct check_answer_label" do
@ -99,7 +99,7 @@ RSpec.describe Form::Sales::Questions::PersonWorkingSituation, type: :model do
end end
it "has the correct header" do 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 end
it "has the correct check_answer_label" do it "has the correct check_answer_label" do
@ -126,7 +126,7 @@ RSpec.describe Form::Sales::Questions::PersonWorkingSituation, type: :model do
end end
it "has the correct header" do 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 end
it "has the correct check_answer_label" do it "has the correct check_answer_label" do

Loading…
Cancel
Save