Browse Source

bulk upload considers housing needs fields

pull/1299/head
Phil Lee 3 years ago
parent
commit
4a0d6ccb7e
  1. 18
      app/services/bulk_upload/lettings/row_parser.rb
  2. 54
      spec/services/bulk_upload/lettings/row_parser_spec.rb

18
app/services/bulk_upload/lettings/row_parser.rb

@ -552,6 +552,8 @@ private
attributes["preg_occ"] = field_47
attributes["housingneeds"] = housingneeds
attributes["housingneeds_type"] = housingneeds_type
attributes["housingneeds_other"] = housingneeds_other
attributes["illness"] = field_118
@ -808,7 +810,7 @@ private
def housingneeds
if field_59 == 1
1
2
elsif field_60 == 1
3
else
@ -816,6 +818,20 @@ private
end
end
def housingneeds_type
if field_55 == 1
0
elsif field_56 == 1
1
elsif field_57 == 1
2
end
end
def housingneeds_other
return 1 if field_58 == 1
end
def ethnic_group_from_ethnic
return nil if field_43.blank?

54
spec/services/bulk_upload/lettings/row_parser_spec.rb

@ -894,6 +894,60 @@ RSpec.describe BulkUpload::Lettings::RowParser do
end
end
end
describe "#housingneeds" do
context "when no disabled needs" do
let(:attributes) { { bulk_upload:, field_59: "1" } }
it "sets to 2" do
expect(parser.log.housingneeds).to eq(2)
end
end
context "when dont know about disabled needs" do
let(:attributes) { { bulk_upload:, field_60: "1" } }
it "sets to 3" do
expect(parser.log.housingneeds).to eq(3)
end
end
end
describe "#housingneeds_type" do
context "when field_55 is 1" do
let(:attributes) { { bulk_upload:, field_55: "1" } }
it "set to 0" do
expect(parser.log.housingneeds_type).to eq(0)
end
end
context "when field_56 is 1" do
let(:attributes) { { bulk_upload:, field_56: "1" } }
it "set to 1" do
expect(parser.log.housingneeds_type).to eq(1)
end
end
context "when field_57 is 1" do
let(:attributes) { { bulk_upload:, field_57: "1" } }
it "set to 2" do
expect(parser.log.housingneeds_type).to eq(2)
end
end
end
describe "#housingneeds_other" do
context "when field_58 is 1" do
let(:attributes) { { bulk_upload:, field_58: "1" } }
it "sets to 1" do
expect(parser.log.housingneeds_other).to eq(1)
end
end
end
end
describe "#start_date" do

Loading…
Cancel
Save