From 38fc2152121249a4158055d67c40737ba76389ef Mon Sep 17 00:00:00 2001 From: Kat Date: Tue, 23 Jan 2024 10:13:54 +0000 Subject: [PATCH] Update fields in first_record_start_date --- app/services/bulk_upload/sales/year2024/csv_parser.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/services/bulk_upload/sales/year2024/csv_parser.rb b/app/services/bulk_upload/sales/year2024/csv_parser.rb index 988875e35..81b7c8f61 100644 --- a/app/services/bulk_upload/sales/year2024/csv_parser.rb +++ b/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