chore: fix problem with enrollment scraper

mciea-main
rebuilt 10 months ago
parent 498d702d95
commit 38cf38fdb5

@ -23,16 +23,16 @@ module Dese
end end
def student_count(filepath:, dese_id:, year:) def student_count(filepath:, dese_id:, year:)
@students ||= {} @student_count ||= {}
if @students.count == 0 if @student_count.count == 0
CSV.parse(File.read(filepath), headers: true).map do |row| CSV.parse(File.read(filepath), headers: true).map do |row|
academic_year = row['Academic Year'] academic_year = row['Academic Year']
school_id = row['DESE ID'].to_i school_id = row['School Code'].to_i
total = row['Total'].gsub(',', '').to_i total = row['Total'].gsub(',', '').to_i
@students[[school_id, academic_year]] = total @student_count[[school_id, academic_year]] = total
end end
end end
@students[[dese_id, year]] @student_count[[dese_id, year]]
end end
end end
end end

@ -56,7 +56,7 @@ class SurveyItemValues
def recorded_date def recorded_date
@recorded_date ||= begin @recorded_date ||= begin
recorded_date = value_from(pattern: /Recorded\s*Date/i) recorded_date = value_from(pattern: /Recorded\s*Date/i)
date = if recorded_date.match(%r{\d+/\d+/\d+}) if recorded_date.match(%r{\d+/\d+/\d+})
Date.strptime(recorded_date, "%m/%d/%Y") Date.strptime(recorded_date, "%m/%d/%Y")
elsif recorded_date.match(/\d+-\d+-\d+(T|\s)\d+:\d+:\d+/) elsif recorded_date.match(/\d+-\d+-\d+(T|\s)\d+:\d+:\d+/)
Date.parse(recorded_date) Date.parse(recorded_date)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save