chore: when searching for dese id, split up pattern so that to be more explicit about the order in which to search out the columns that might have the dese ID we're looking for.

This commit is contained in:
Nelson Jovel 2023-11-06 13:13:37 -08:00
parent cddea60c8b
commit b63c327d33
4 changed files with 12 additions and 57 deletions

View file

@ -81,13 +81,9 @@ class SurveyItemValues
def dese_id
@dese_id ||= begin
dese_id = nil
dese_headers = ["DESE ID", "Dese ID", "DeseId", "DeseID", "School", "school"]
school_headers = headers.select { |header| /School-\s\w/.match(header) }
dese_headers << school_headers
dese_headers.flatten.each do |header|
dese_id ||= row[header]
end
dese_id = value_from(pattern: /Dese\s*ID/i)
dese_id ||= value_from(pattern: /^School$/i)
dese_id ||= value_from(pattern: /School-\s*\w/i)
dese_id.to_i
end