Browse Source

Update fields in first_record_start_date

pull/2154/head
Kat 2 years ago
parent
commit
38fc215212
  1. 5
      app/services/bulk_upload/sales/year2024/csv_parser.rb

5
app/services/bulk_upload/sales/year2024/csv_parser.rb

@ -80,6 +80,7 @@ private
end
def with_headers?
# we will eventually want to validate that headers exist for this year
rows.map { |r| r[0] }.any? { |cell| cell&.match?(/field number/i) }
end
@ -100,9 +101,9 @@ private
def first_record_start_date
if with_headers?
Date.new(row_parsers.first.field_4.to_i + 2000, row_parsers.first.field_3.to_i, row_parsers.first.field_2.to_i)
Date.new(row_parsers.first.field_6.to_i + 2000, row_parsers.first.field_5.to_i, row_parsers.first.field_4.to_i)
else
Date.new(rows.first[3].to_i + 2000, rows.first[2].to_i, rows.first[1].to_i)
Date.new(rows.first[5].to_i + 2000, rows.first[4].to_i, rows.first[3].to_i)
end
end
end

Loading…
Cancel
Save