diff --git a/app/services/bulk_upload/lettings/year2024/row_parser.rb b/app/services/bulk_upload/lettings/year2024/row_parser.rb index 0c5e57ce8..34823ee91 100644 --- a/app/services/bulk_upload/lettings/year2024/row_parser.rb +++ b/app/services/bulk_upload/lettings/year2024/row_parser.rb @@ -946,8 +946,9 @@ private rp_dontknow: %i[field_111], cbl: %i[field_112], - chr: %i[field_114], cap: %i[field_113], + chr: %i[field_114], + accessible_register: %i[field_115], letting_allocation: %i[field_112 field_113 field_114 field_115], referral: %i[field_116], @@ -1134,6 +1135,7 @@ private attributes["cbl"] = cbl attributes["chr"] = chr attributes["cap"] = cap + attributes["accessible_register"] = accessible_register attributes["letting_allocation_unknown"] = letting_allocation_unknown attributes["referral"] = field_116 @@ -1383,6 +1385,15 @@ private end end + def cap + case field_113 + when 2 + 0 + when 1 + 1 + end + end + def chr case field_114 when 2 @@ -1392,8 +1403,8 @@ private end end - def cap - case field_113 + def accessible_register + case field_115 when 2 0 when 1 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 58be059fc..4501d25be 100644 --- a/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb @@ -1119,6 +1119,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do expect(parser.errors[:field_112]).to include("You must answer was the letting made under the Choice-Based Lettings (CBL)?") expect(parser.errors[:field_113]).to include("You must answer was the letting made under the Common Allocation Policy (CAP)?") expect(parser.errors[:field_114]).to include("You must answer was the letting made under the Common Housing Register (CHR)?") + expect(parser.errors[:field_115]).to include("You must answer was the letting made under the Accessible Register?") end end end @@ -1889,16 +1890,16 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do end describe "#letting_allocation_unknown" do - context "when field_112, 117, 118 are no ie 2" do - let(:attributes) { { bulk_upload:, field_112: 2, field_113: 2, field_114: 2 } } + context "when field_112, 113, 114, 115 are no ie 2" do + let(:attributes) { { bulk_upload:, field_112: 2, field_113: 2, field_114: 2, field_115: 2 } } it "sets value to 1" do expect(parser.log.letting_allocation_unknown).to be(1) end end - context "when any one of field_112, 117, 118 is yes ie 1" do - let(:attributes) { { bulk_upload:, field_112: 1 } } + context "when any one of field_112, 113, 114, 115 is yes ie 1" do + let(:attributes) { { bulk_upload:, field_115: 1 } } it "sets value to 0" do expect(parser.log.letting_allocation_unknown).to be(0)