mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
chore: generate report of high number of nil grades in responses
This commit is contained in:
parent
ed3ac25a7b
commit
c724996b6b
1 changed files with 14 additions and 0 deletions
|
|
@ -140,4 +140,18 @@ namespace :one_off do
|
|||
academic_year.delete
|
||||
end
|
||||
end
|
||||
|
||||
desc "print out percentage of nil values for range"
|
||||
task nil_grades: :environment do
|
||||
AcademicYear.all.each do |academic_year|
|
||||
School.all.each do |school|
|
||||
total = SurveyItemResponse.where(school:, academic_year:,
|
||||
survey_item: SurveyItem.student_survey_items).count.to_f
|
||||
nil_count = SurveyItemResponse.where(school:, academic_year:, grade: nil,
|
||||
survey_item: SurveyItem.student_survey_items).count
|
||||
percentage = ((nil_count / total) * 100).round(1)
|
||||
puts "#{percentage}% nil grades for: #{school.name}, #{academic_year.range}" if percentage > 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue