app/importers/file_importers/attendance_importer.rb
# Matches a row from a CSV export with an existing or new (unsaved) Insights record
# Returns nil if something about the CSV row is invalid and it can't process the row.
Matches a row from a CSV export with an existing or new (unsaved) Insights record
Returns nil if something about the CSV row is invalid and it can't process the row.
Matches a row from a CSV export with an existing or new ( unsaved ) Insights record Returns nil if something about the CSV row is invalid and it can ' t process the row .
def matching_insights_record_for_row(row, record_class)
    student_id = @student_ids_map.lookup_student_id(row[:local_id])
    return nil if student_id.nil?
    attendance_event = record_class.find_or_initialize_by(
      occurred_at: row[:event_date],
      student_id: student_id,
    )
    if PerDistrict.new.import_detailed_attendance_fields?
      attendance_event.assign_attributes(
        dismissed: row[:dismissed],
        excused: row[:excused],
        reason: row[:reason],
        comment: row[:comment],
      )
    end
    attendance_event
  end
def matching_insights_record_for_row ( row , record_class ) student_id = @student_ids_map . lookup_student_id ( row [ :local_id ] ) return nil if student_id . nil? attendance_event = record_class . find_or_initialize_by ( occurred_at : row [ :event_date ] , student_id : student_id , ) if PerDistrict . new . import_detailed_attendance_fields? attendance_event . assign_attributes ( dismissed : row [ :dismissed ] , excused : row [ :excused ] , reason : row [ :reason ] , comment : row [ :comment ] , ) end attendance_event end
Matches a row from a CSV export with an existing or new (unsaved) Insights record
Returns nil if something about the CSV row is invalid and it can't process the row.
Matches a row from a CSV export with an existing or new ( unsaved ) Insights record Returns nil if something about the CSV row is invalid and it can ' t process the row .
# There are some additional fields for some districts.
row
<not_specific>
record_class
<not_specific>