diff --git a/app/services/bulk_upload/lettings/year2022/row_parser.rb b/app/services/bulk_upload/lettings/year2022/row_parser.rb index cdd47f99f..66cd4d12b 100644 --- a/app/services/bulk_upload/lettings/year2022/row_parser.rb +++ b/app/services/bulk_upload/lettings/year2022/row_parser.rb @@ -1254,7 +1254,7 @@ private 2 elsif field_60 == 1 3 - elsif field_59&.zero? + elsif field_59.blank? || field_59&.zero? 1 end end diff --git a/app/services/bulk_upload/lettings/year2023/row_parser.rb b/app/services/bulk_upload/lettings/year2023/row_parser.rb index 7374e6208..69327ffc0 100644 --- a/app/services/bulk_upload/lettings/year2023/row_parser.rb +++ b/app/services/bulk_upload/lettings/year2023/row_parser.rb @@ -1177,7 +1177,7 @@ private 2 elsif field_88 == 1 3 - elsif field_87&.zero? + elsif field_87.blank? || field_87&.zero? 1 end end diff --git a/spec/services/bulk_upload/lettings/year2022/row_parser_spec.rb b/spec/services/bulk_upload/lettings/year2022/row_parser_spec.rb index afd68644e..657773be4 100644 --- a/spec/services/bulk_upload/lettings/year2022/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2022/row_parser_spec.rb @@ -1472,6 +1472,16 @@ RSpec.describe BulkUpload::Lettings::Year2022::RowParser do end end + context "when housingneeds are given and field_59 is nil" do + let(:attributes) { { bulk_upload:, field_57: "1", field_58: "1", field_59: nil } } + + it "sets correct housingneeds" do + expect(parser.log.housingneeds).to eq(1) + expect(parser.log.housingneeds_type).to eq(2) + expect(parser.log.housingneeds_other).to eq(1) + end + end + context "when housingneeds a and b are selected" do let(:attributes) { { bulk_upload:, field_55: "1", field_56: "1" } } diff --git a/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb b/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb index 67dc69bbe..03a5f5ca3 100644 --- a/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb @@ -1468,6 +1468,16 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do end end + context "when housingneeds are given and field_86 is nil" do + let(:attributes) { { bulk_upload:, field_87: nil, field_85: "1", field_86: "1" } } + + it "sets correct housingneeds" do + expect(parser.log.housingneeds).to eq(1) + expect(parser.log.housingneeds_type).to eq(2) + expect(parser.log.housingneeds_other).to eq(1) + end + end + context "when housingneeds a and b are selected" do let(:attributes) { { bulk_upload:, field_83: "1", field_84: "1" } }