Browse Source

bulk upload earnings accepts pennies but rounds

remotes/origin/bulk-upload-errors-integration
Phil Lee 3 years ago
parent
commit
0002e79960
  1. 8
      app/services/bulk_upload/lettings/row_parser.rb
  2. 8
      spec/services/bulk_upload/lettings/row_parser_spec.rb

8
app/services/bulk_upload/lettings/row_parser.rb

@ -53,7 +53,7 @@ class BulkUpload::Lettings::RowParser
attribute :field_47, :integer
attribute :field_48, :integer
attribute :field_49, :integer
attribute :field_50, :integer
attribute :field_50, :decimal
attribute :field_51, :integer
attribute :field_52, :integer
attribute :field_53, :string
@ -502,7 +502,7 @@ private
attributes["referral"] = field_78
attributes["net_income_known"] = net_income_known
attributes["earnings"] = field_50
attributes["earnings"] = earnings
attributes["incfreq"] = field_116
attributes["hb"] = field_48
attributes["benefits"] = field_49
@ -535,6 +535,10 @@ private
attributes
end
def earnings
field_50.round if field_50.present?
end
def net_income_known
case field_51
when 1

8
spec/services/bulk_upload/lettings/row_parser_spec.rb

@ -549,5 +549,13 @@ RSpec.describe BulkUpload::Lettings::RowParser do
expect(parser.log.tenancylength).to eq(2)
end
end
describe "#earnings" do
let(:attributes) { { bulk_upload:, field_50: "104.50" } }
it "rounds to the nearest whole pound" do
expect(parser.log.earnings).to eq(105)
end
end
end
end

Loading…
Cancel
Save