Browse Source

extract TYPE_OF_UNIT_MAP

pull/713/head
Kat 3 years ago
parent
commit
e8e9a85741
  1. 18
      app/models/derived_variables/case_log_variables.rb

18
app/models/derived_variables/case_log_variables.rb

@ -1,5 +1,13 @@
module DerivedVariables::CaseLogVariables
RENT_TYPE_MAPPING = { 0 => 1, 1 => 2, 2 => 2, 3 => 3, 4 => 3, 5 => 3 }.freeze
TYPE_OF_UNIT_MAP = {
"Self-contained flat or bedsit" => 1,
"Self-contained flat or bedsit with common facilities" => 2,
"Shared flat" => 3,
"Shared house or hostel" => 4,
"Bungalow" => 5,
"Self-contained house" => 6,
}.freeze
def supported_housing_schemes_enabled?
FeatureToggle.supported_housing_schemes_enabled?
@ -75,15 +83,7 @@ module DerivedVariables::CaseLogVariables
if location
self.la = location.county
self.postcode_full = location.postcode
type_of_unit_map = {
"Self-contained flat or bedsit" => 1,
"Self-contained flat or bedsit with common facilities" => 2,
"Shared flat" => 3,
"Shared house or hostel" => 4,
"Bungalow" => 5,
"Self-contained house" => 6,
}
self.unittype_sh = type_of_unit_map[location.type_of_unit]
self.unittype_sh = TYPE_OF_UNIT_MAP[location.type_of_unit]
self.builtype = form.questions.find { |x| x.id == "builtype" }.answer_options.select { |_key, value| value["value"] == location.type_of_building }.keys.first
wheelchair_adaptation_map = { 1 => 1, 0 => 2 }
self.wchair = wheelchair_adaptation_map[location.wheelchair_adaptation.to_i]

Loading…
Cancel
Save