Browse Source

add first time social housing to bulk upload

pull/1148/head
Phil Lee 3 years ago
parent
commit
438dd73b58
  1. 15
      app/services/bulk_upload/lettings/row_parser.rb
  2. 10
      spec/services/bulk_upload/lettings/row_parser_spec.rb

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

@ -545,7 +545,7 @@ private
attributes["hhmemb"] = hhmemb
attributes["unitletas"] = field_105
attributes["rsnvac"] = field_106
attributes["rsnvac"] = rsnvac
attributes["sheltered"] = field_117
attributes["illness_type_1"] = field_119
@ -571,9 +571,22 @@ private
attributes["voiddate"] = voiddate
attributes["first_time_property_let_as_social_housing"] = first_time_property_let_as_social_housing
attributes
end
def first_time_property_let_as_social_housing
case rsnvac
when 15, 16, 17
1
end
end
def rsnvac
field_106
end
def voiddate
Date.new(field_91 + 2000, field_90, field_89) if field_91.present? && field_90.present? && field_89.present?
end

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

@ -723,5 +723,15 @@ RSpec.describe BulkUpload::Lettings::RowParser do
end
end
end
describe "#first_time_property_let_as_social_housing" do
context "when field_106 is 15, 16, or 17" do
let(:attributes) { { bulk_upload:, field_106: %w[15 16 17].sample } }
it "sets to 1" do
expect(parser.log.first_time_property_let_as_social_housing).to eq(1)
end
end
end
end
end

Loading…
Cancel
Save