Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSV Import - correctly report validation error for timestamp #1263

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/services/organizations/importers/csv_import_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ def call
catch(:halt_import) do
validate_file

CSV.foreach(@file.to_path, headers: true, skip_blanks: true).with_index(1) do |row, index|
CSV.foreach(@file.to_path, headers: true, skip_blanks: true).with_index(2) do |row, index|
# Header may be different depending on which form applicaiton was used(e.g. google forms) or how it was created(User creates form with "Email Address")
email = row[@email_header].downcase
# Google forms uses "Timestamp", other services may use a different header
csv_timestamp = Time.parse(row["Timestamp"])
csv_timestamp = Time.parse(row["Timestamp"]) if row["Timestamp"].present?

person = Person.find_by(email:, organization: @organization)
previously_matched_form_submission = FormSubmission.where(person:, csv_timestamp:)
Expand Down
Loading