chore: fixed seeder.

This commit is contained in:
Nelson Jovel 2024-01-17 12:47:45 -08:00
parent 0af7d42e52
commit 1b0af124f7
4 changed files with 17 additions and 33 deletions

View file

@ -5,15 +5,12 @@ require "csv"
module Dashboard
class EnrollmentLoader
def load_data(filepath:)
schools = []
enrollments = []
CSV.parse(File.read(filepath), headers: true) do |row|
row = EnrollmentRowValues.new(row:, schools: school_hash, academic_years: academic_year_hash)
next unless row.school.present? && row.academic_year.present?
schools << row.school
enrollments << create_enrollment_entry(row:)
end