Browse Source

feat: update bulk upload inferral

pull/2167/head
natdeanlewissoftwire 2 years ago
parent
commit
f837b313da
  1. 2
      app/services/bulk_upload/lettings/year2024/row_parser.rb
  2. 18
      spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb

2
app/services/bulk_upload/lettings/year2024/row_parser.rb

@ -1036,7 +1036,7 @@ private
attributes["unittype_gn"] = field_26
attributes["builtype"] = field_27
attributes["wchair"] = field_28
attributes["beds"] = field_29
attributes["beds"] = field_26 == 2 ? 1 : field_29
attributes["joint"] = field_36
attributes["startertenancy"] = field_37
attributes["tenancy"] = field_38

18
spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb

@ -1742,6 +1742,24 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
end
end
describe "#beds" do
context "when property is a bedsit" do
let(:attributes) { setup_section_params.merge({ field_26: 2, field_29: 2 }) }
it "sets value to 1 even if field_29 contradicts this" do
expect(parser.log.beds).to be(1)
end
end
context "when property is not a bedsit" do
let(:attributes) { setup_section_params.merge({ field_26: 1, field_29: 2 }) }
it "sets value to field_29" do
expect(parser.log.beds).to be(2)
end
end
end
describe "#cbl" do
context "when field_112 is yes ie 1" do
let(:attributes) { { bulk_upload:, field_112: 1 } }

Loading…
Cancel
Save