chore: correctly detect missing grade header

rpp-main
rebuilt 9 months ago
parent 1e71a2ed30
commit 8a3db1d214

@ -61,12 +61,12 @@ class Cleaner
# If this is a student survey # If this is a student survey
# Make sure it includes a 'Grade' header # Make sure it includes a 'Grade' header
student_survey_is_missing_grade_header = headers is_student_survey = headers.filter(&:present?)
.filter(&:present?) .filter { |header| header.start_with? "s-" }
.filter { |header| header.start_with? "s-" }.count > 0 && !headers.find do |header| .count > 0
header.match?(/grade/i)
end has_grade_header = headers.filter(&:present?).find {|header| header.match?(/grade/i) }.present?
if student_survey_is_missing_grade_header if is_student_survey && has_grade_header == false
puts "could not find the Grade header. Stopping execution" puts "could not find the Grade header. Stopping execution"
exit exit
end end

Loading…
Cancel
Save