mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-08 23:18:18 -07:00
print the number of student and teacher respondents
This commit is contained in:
parent
f7818fc9f6
commit
5f58a5516e
1 changed files with 18 additions and 2 deletions
|
|
@ -174,10 +174,26 @@ namespace :one_off do
|
|||
District.all.each do |district|
|
||||
num_of_respondents = SurveyItemResponse.joins(school: :district).where(academic_year:,
|
||||
"schools.district": district).pluck(:response_id).uniq.count
|
||||
teacher_respondents = SurveyItemResponse.joins(school: :district).where(academic_year:,
|
||||
survey_item: SurveyItem.where('survey_item_id like ? ', 't-%'), "schools.district": district).pluck(:response_id).uniq.count
|
||||
student_respondents = SurveyItemResponse.joins(school: :district).where(academic_year:,
|
||||
survey_item: SurveyItem.where('survey_item_id like ? ', 's-%'), "schools.district": district).pluck(:response_id).uniq.count
|
||||
|
||||
response_count = SurveyItemResponse.joins(school: :district).where(academic_year:,
|
||||
"schools.district": district).count
|
||||
puts "=====================> #{district.name} has #{num_of_respondents} respondents"
|
||||
puts "=====================> #{district.name} has #{response_count} responses"
|
||||
student_response_count = SurveyItemResponse.joins(school: :district).joins(:survey_item).where(academic_year:,
|
||||
survey_item: SurveyItem.where('survey_item_id like ? ', 's-%'), "schools.district": district).count
|
||||
teacher_response_count = SurveyItemResponse.joins(school: :district).joins(:survey_item).where(academic_year:,
|
||||
survey_item: SurveyItem.where('survey_item_id like ? ', 't-%'), "schools.district": district).count
|
||||
puts "#{district.name} has #{num_of_respondents} respondents"
|
||||
|
||||
puts "#{district.name} has #{num_of_respondents} respondents"
|
||||
puts "#{district.name} has #{teacher_respondents} teacher respondents"
|
||||
puts "#{district.name} has #{student_respondents} student respondents"
|
||||
puts "#{district.name} has #{response_count} responses"
|
||||
puts "#{district.name} has #{student_response_count} teacher responses"
|
||||
puts "#{district.name} has #{teacher_response_count} student responses"
|
||||
puts "\n"
|
||||
end
|
||||
Rails.cache.clear
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue