chore: fix problem with enrollment scraper

main-eol
rebuilt 10 months ago
parent 76b53ef1e4
commit 1de5d4d456

@ -22,16 +22,16 @@ module Dese
end
def student_count(filepath:, dese_id:, year:)
@students ||= {}
if @students.count == 0
@student_count ||= {}
if @student_count.count == 0
CSV.parse(File.read(filepath), headers: true).map do |row|
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
@students[[school_id, academic_year]] = total
@student_count[[school_id, academic_year]] = total
end
end
@students[[dese_id, year]]
@student_count[[dese_id, year]]
end
end
end

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

File diff suppressed because it is too large Load Diff

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