Browse Source

add rent fields to bulk upload

remotes/origin/bulk-upload-errors-integration
Phil Lee 3 years ago
parent
commit
27667f0ef3
  1. 15
      app/services/bulk_upload/lettings/row_parser.rb
  2. 7
      spec/services/bulk_upload/lettings/row_parser_spec.rb

15
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

7
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

Loading…
Cancel
Save