diff --git a/app/services/bulk_upload/lettings/row_parser.rb b/app/services/bulk_upload/lettings/row_parser.rb index 484a5e1af..dbd9546a2 100644 --- a/app/services/bulk_upload/lettings/row_parser.rb +++ b/app/services/bulk_upload/lettings/row_parser.rb @@ -291,6 +291,11 @@ private net_income_known: %i[field_51], hb: %i[field_48], benefits: %i[field_49], + + period: %i[field_79], + brent: %i[field_80], + hbrentshortfall: %i[field_87], + tshortfall: %i[field_88], } end @@ -425,9 +430,19 @@ private attributes["hb"] = field_48 attributes["benefits"] = field_49 + attributes["period"] = field_79 + attributes["brent"] = field_80 + attributes["hbrentshortfall"] = field_87 + attributes["tshortfall_known"] = tshortfall_known + attributes["tshortfall"] = field_88 + attributes end + def tshortfall_known + field_87 == 1 ? 0 : 1 + end + def letting_allocation_unknown [cbl, chr, cap].all?(0) ? 1 : 0 end diff --git a/spec/services/bulk_upload/lettings/row_parser_spec.rb b/spec/services/bulk_upload/lettings/row_parser_spec.rb index 8a27430e8..04be821ab 100644 --- a/spec/services/bulk_upload/lettings/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/row_parser_spec.rb @@ -120,6 +120,11 @@ RSpec.describe BulkUpload::Lettings::RowParser do field_51: "1", field_48: "1", field_49: "1", + + field_79: "4", + field_80: "1234.56", + field_87: "1", + field_88: "234.56", } end @@ -132,7 +137,7 @@ RSpec.describe BulkUpload::Lettings::RowParser do parser.send(:log).optional_fields.include?(q.id) || q.completed?(parser.send(:log)) end - expect(questions.map(&:id).size).to be(0) + expect(questions.map(&:id).size).to eq(0) expect(questions.map(&:id)).to eql([]) end end