Browse Source

remove inferring builtype

pull/735/head
Kat 3 years ago
parent
commit
85b7a4fb67
  1. 1
      app/models/derived_variables/case_log_variables.rb
  2. 5
      spec/models/case_log_spec.rb

1
app/models/derived_variables/case_log_variables.rb

@ -75,7 +75,6 @@ module DerivedVariables::CaseLogVariables
if location
self.la = location.county
self.postcode_full = location.postcode
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

5
spec/models/case_log_spec.rb

@ -1730,11 +1730,6 @@ RSpec.describe CaseLog do
expect(supported_housing_case_log.unittype_sh).to eq(1)
end
it "correctly infers and saves type of building" do
record_from_db = ActiveRecord::Base.connection.execute("SELECT builtype from case_logs WHERE id=#{supported_housing_case_log.id}").to_a[0]
expect(record_from_db["builtype"]).to eq(1)
end
it "correctly infers and saves wchair" do
record_from_db = ActiveRecord::Base.connection.execute("SELECT wchair from case_logs WHERE id=#{supported_housing_case_log.id}").to_a[0]
expect(record_from_db["wchair"]).to eq(2)

Loading…
Cancel
Save