From f837b313dae701302b58b513aec9ff85c5bab1ea Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Fri, 2 Feb 2024 09:35:04 +0000 Subject: [PATCH] feat: update bulk upload inferral --- .../lettings/year2024/row_parser.rb | 2 +- .../lettings/year2024/row_parser_spec.rb | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/services/bulk_upload/lettings/year2024/row_parser.rb b/app/services/bulk_upload/lettings/year2024/row_parser.rb index 19bae0ecc..5bd76505b 100644 --- a/app/services/bulk_upload/lettings/year2024/row_parser.rb +++ b/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 diff --git a/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb b/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb index 5f34ec80a..d1f805e9e 100644 --- a/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb +++ b/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 } }