diff --git a/app/models/derived_variables/case_log_variables.rb b/app/models/derived_variables/case_log_variables.rb index 9c60cdc99..33fcef3d1 100644 --- a/app/models/derived_variables/case_log_variables.rb +++ b/app/models/derived_variables/case_log_variables.rb @@ -84,7 +84,7 @@ module DerivedVariables::CaseLogVariables self.la = location.county self.postcode_full = location.postcode 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 + self.builtype = form.questions.find { |x| x.id == "builtype" }.answer_options.find { |_key, value| value["value"] == location.type_of_building }.first wheelchair_adaptation_map = { 1 => 1, 0 => 2 } self.wchair = wheelchair_adaptation_map[location.wheelchair_adaptation.to_i] end diff --git a/db/seeds.rb b/db/seeds.rb index be13a937c..3ac0aa7d5 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -115,7 +115,7 @@ unless Rails.env.test? postcode: "CU193AA", name: "Rectory Road", type_of_unit: 4, - type_of_building: "Purpose-built", + type_of_building: "Purpose built", county: "Mid Sussex", wheelchair_adaptation: 0, ) diff --git a/spec/factories/location.rb b/spec/factories/location.rb index 53f8d2cd0..efec1aa76 100644 --- a/spec/factories/location.rb +++ b/spec/factories/location.rb @@ -4,7 +4,7 @@ FactoryBot.define do postcode { Faker::Address.postcode.delete(" ") } name { Faker::Address.street_name } type_of_unit { Faker::Number.within(range: 1..6) } - type_of_building { Faker::Lorem.word } + type_of_building { "Purpose built" } wheelchair_adaptation { 0 } county { Faker::Address.state } scheme