baarkerlounger
3 years ago
9 changed files with 55 additions and 43 deletions
@ -1,15 +1,39 @@ |
|||||||
class Form < ApplicationRecord |
class Form < ApplicationRecord |
||||||
self.abstract_class = true |
self.abstract_class = true |
||||||
|
|
||||||
FIRST_QUESTION_FOR_SUBSECTION = { |
SECTIONS = { |
||||||
"Household characteristics" => "form/questions/tenant_code", |
"About the household" => %w[household_characteristics household_situation household_needs], |
||||||
"Household situation" => "form/questions/previous_housing_situation" |
"Tenancy and property information" => %w[tenancy_information property_information], |
||||||
|
"Rent and charges" => %w[income_and_benefits rent], |
||||||
|
"Local Authority" => %w[local_authority], |
||||||
|
"Submission" => %w[declaration], |
||||||
|
}.freeze |
||||||
|
|
||||||
|
SUBSECTIONS = { |
||||||
|
"household_characteristics" => "tenant_code", |
||||||
|
"household_situation" => "previous_housing_situation", |
||||||
|
"household_needs" => "tenant_code", |
||||||
|
"tenancy_information" => "tenant_code", |
||||||
|
"property_information" => "tenant_code", |
||||||
|
"income_and_benefits" => "tenant_code", |
||||||
|
"rent" => "tenant_code", |
||||||
|
"local_authority" => "tenant_code", |
||||||
|
"declaration" => "tenant_code", |
||||||
}.freeze |
}.freeze |
||||||
|
|
||||||
QUESTIONS = { |
QUESTIONS = { |
||||||
"tenant_code" => "form/questions/tenant_age", |
"tenant_code" => "tenant_age", |
||||||
"tenant_age" => "form/questions/tenant_gender", |
"tenant_age" => "tenant_gender", |
||||||
"tenant_gender" => "form/questions/tenant_ethnic_group", |
"tenant_gender" => "tenant_ethnic_group", |
||||||
"tenant_ethnic_group" => "form/questions/tenant_nationality", |
"tenant_ethnic_group" => "tenant_nationality", |
||||||
|
"previous_housing_situation" => "previous_housing_situation", |
||||||
}.freeze |
}.freeze |
||||||
|
|
||||||
|
def self.first_question_for_subsection(subsection) |
||||||
|
SUBSECTIONS[subsection] |
||||||
|
end |
||||||
|
|
||||||
|
def self.next_question(previous_question) |
||||||
|
Form::QUESTIONS[previous_question] |
||||||
|
end |
||||||
end |
end |
||||||
|
Loading…
Reference in new issue