Browse Source

Refactor person question numbers

pull/2252/head
Kat 2 years ago
parent
commit
7dcd54186b
  1. 14
      app/models/form/sales/questions/person_age.rb
  2. 14
      app/models/form/sales/questions/person_age_known.rb
  3. 14
      app/models/form/sales/questions/person_gender_identity.rb
  4. 14
      app/models/form/sales/questions/person_relationship_to_buyer_1.rb
  5. 14
      app/models/form/sales/questions/person_working_situation.rb

14
app/models/form/sales/questions/person_age.rb

@ -17,11 +17,13 @@ class Form::Sales::Questions::PersonAge < ::Form::Question
end
def question_number
case form.start_date.year
when 2023
29 + (4 * @person_index)
else
31 + (4 * @person_index)
end
base_question_number = case form.start_date.year
when 2023
29
else
31
end
base_question_number + (4 * @person_index)
end
end

14
app/models/form/sales/questions/person_age_known.rb

@ -28,11 +28,13 @@ class Form::Sales::Questions::PersonAgeKnown < ::Form::Question
}.freeze
def question_number
case form.start_date.year
when 2023
29 + (4 * @person_index)
else
31 + (4 * @person_index)
end
base_question_number = case form.start_date.year
when 2023
29
else
31
end
base_question_number + (4 * @person_index)
end
end

14
app/models/form/sales/questions/person_gender_identity.rb

@ -29,11 +29,13 @@ class Form::Sales::Questions::PersonGenderIdentity < ::Form::Question
end
def question_number
case form.start_date.year
when 2023
30 + (4 * @person_index)
else
32 + (4 * @person_index)
end
base_question_number = case form.start_date.year
when 2023
30
else
32
end
base_question_number + (4 * @person_index)
end
end

14
app/models/form/sales/questions/person_relationship_to_buyer_1.rb

@ -23,11 +23,13 @@ class Form::Sales::Questions::PersonRelationshipToBuyer1 < ::Form::Question
}.freeze
def question_number
case form.start_date.year
when 2023
28 + (4 * @person_index)
when 2024
30 + (4 * @person_index)
end
base_question_number = case form.start_date.year
when 2023
28
else
30
end
base_question_number + (4 * @person_index)
end
end

14
app/models/form/sales/questions/person_working_situation.rb

@ -30,11 +30,13 @@ class Form::Sales::Questions::PersonWorkingSituation < ::Form::Question
}.freeze
def question_number
case form.start_date.year
when 2023
31 + (4 * @person_index)
else
33 + (4 * @person_index)
end
base_question_number = case form.start_date.year
when 2023
31
else
33
end
base_question_number + (4 * @person_index)
end
end

Loading…
Cancel
Save