|
|
@ -1,12 +1,12 @@ |
|
|
|
class Form::Sales::Questions::PersonWorkingSituation < ::Form::Question |
|
|
|
class Form::Sales::Questions::PersonWorkingSituation < ::Form::Question |
|
|
|
def initialize(id, hsh, page) |
|
|
|
def initialize(id, hsh, page) |
|
|
|
super |
|
|
|
super |
|
|
|
@check_answer_label = "Person #{PERSON_INDEX[page.id]}’s working situation" |
|
|
|
@check_answer_label = "Person #{person_display_number}’s working situation" |
|
|
|
@header = "Which of these best describes Person #{PERSON_INDEX[page.id]}’s working situation?" |
|
|
|
@header = "Which of these best describes Person #{person_display_number}’s working situation?" |
|
|
|
@type = "radio" |
|
|
|
@type = "radio" |
|
|
|
@page = page |
|
|
|
@page = page |
|
|
|
@answer_options = ANSWER_OPTIONS |
|
|
|
@answer_options = ANSWER_OPTIONS |
|
|
|
@check_answers_card_number = CARD_INDEX[page.id] |
|
|
|
@check_answers_card_number = person_database_number |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
ANSWER_OPTIONS = { |
|
|
|
ANSWER_OPTIONS = { |
|
|
@ -23,25 +23,23 @@ class Form::Sales::Questions::PersonWorkingSituation < ::Form::Question |
|
|
|
"9" => { "value" => "Child under 16" }, |
|
|
|
"9" => { "value" => "Child under 16" }, |
|
|
|
}.freeze |
|
|
|
}.freeze |
|
|
|
|
|
|
|
|
|
|
|
CARD_INDEX = { |
|
|
|
def person_database_number |
|
|
|
"person_1_working_situation" => 2, |
|
|
|
PERSON_INDEX[id] |
|
|
|
"person_1_working_situation_joint_purchase" => 3, |
|
|
|
end |
|
|
|
"person_2_working_situation" => 3, |
|
|
|
|
|
|
|
"person_2_working_situation_joint_purchase" => 4, |
|
|
|
|
|
|
|
"person_3_working_situation" => 4, |
|
|
|
|
|
|
|
"person_3_working_situation_joint_purchase" => 5, |
|
|
|
|
|
|
|
"person_4_working_situation" => 5, |
|
|
|
|
|
|
|
"person_4_working_situation_joint_purchase" => 6, |
|
|
|
|
|
|
|
}.freeze |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PERSON_INDEX = { |
|
|
|
PERSON_INDEX = { |
|
|
|
"person_1_working_situation" => 1, |
|
|
|
"ecstat2" => 2, |
|
|
|
"person_1_working_situation_joint_purchase" => 1, |
|
|
|
"ecstat3" => 3, |
|
|
|
"person_2_working_situation" => 2, |
|
|
|
"ecstat4" => 4, |
|
|
|
"person_2_working_situation_joint_purchase" => 2, |
|
|
|
"ecstat5" => 5, |
|
|
|
"person_3_working_situation" => 3, |
|
|
|
"ecstat6" => 6, |
|
|
|
"person_3_working_situation_joint_purchase" => 3, |
|
|
|
|
|
|
|
"person_4_working_situation" => 4, |
|
|
|
|
|
|
|
"person_4_working_situation_joint_purchase" => 4, |
|
|
|
|
|
|
|
}.freeze |
|
|
|
}.freeze |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def person_display_number |
|
|
|
|
|
|
|
joint_purchase? ? PERSON_INDEX[id] - 2 : PERSON_INDEX[id] - 1 |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def joint_purchase? |
|
|
|
|
|
|
|
page.id.include?("_joint_purchase") |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|