Browse Source

Fix person relationship numbering

CLDC-1864-question-numbering
Kat 2 years ago
parent
commit
23d82d571d
  1. 17
      app/models/form/lettings/questions/person_relationship.rb
  2. 17
      app/models/form/sales/questions/person_relationship_to_buyer_1.rb
  3. 8
      spec/models/form/sales/questions/person_relationship_to_buyer1_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 = "#{question_number(person_index)} - What is person #{person_index}’s relationship to the lead tenant?" @header = "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,19 +20,4 @@ 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_relationship_to_buyer_1.rb

@ -2,7 +2,7 @@ class Form::Sales::Questions::PersonRelationshipToBuyer1 < ::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 relationship to Buyer 1" @check_answer_label = "Person #{person_index}’s relationship to Buyer 1"
@header = "What is Person #{person_index}’s relationship to Buyer 1?" @header = "#{question_number(person_index)} - What is Person #{person_index}’s relationship to Buyer 1?"
@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::PersonRelationshipToBuyer1 < ::Form::Question
"X" => { "value" => "Other" }, "X" => { "value" => "Other" },
"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

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

@ -42,7 +42,7 @@ RSpec.describe Form::Sales::Questions::PersonRelationshipToBuyer1, type: :model
end end
it "has the correct header" do it "has the correct header" do
expect(question.header).to eq("What is Person 2’s relationship to Buyer 1?") expect(question.header).to eq("Q36 - What is Person 2’s relationship to Buyer 1?")
end end
it "has the correct check_answer_label" do it "has the correct check_answer_label" do
@ -69,7 +69,7 @@ RSpec.describe Form::Sales::Questions::PersonRelationshipToBuyer1, type: :model
end end
it "has the correct header" do it "has the correct header" do
expect(question.header).to eq("What is Person 3’s relationship to Buyer 1?") expect(question.header).to eq("Q40 - What is Person 3’s relationship to Buyer 1?")
end end
it "has the correct check_answer_label" do it "has the correct check_answer_label" do
@ -96,7 +96,7 @@ RSpec.describe Form::Sales::Questions::PersonRelationshipToBuyer1, type: :model
end end
it "has the correct header" do it "has the correct header" do
expect(question.header).to eq("What is Person 4’s relationship to Buyer 1?") expect(question.header).to eq("Q44 - What is Person 4’s relationship to Buyer 1?")
end end
it "has the correct check_answer_label" do it "has the correct check_answer_label" do
@ -123,7 +123,7 @@ RSpec.describe Form::Sales::Questions::PersonRelationshipToBuyer1, type: :model
end end
it "has the correct header" do it "has the correct header" do
expect(question.header).to eq("What is Person 5’s relationship to Buyer 1?") expect(question.header).to eq("Q48 - What is Person 5’s relationship to Buyer 1?")
end end
it "has the correct check_answer_label" do it "has the correct check_answer_label" do

Loading…
Cancel
Save