mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
Add one off script to list the survey items that lack survey item responses per year, per district
This commit is contained in:
parent
87e6a998b7
commit
d4413f6886
1 changed files with 21 additions and 0 deletions
|
|
@ -64,4 +64,25 @@ namespace :one_off do
|
|||
output = output.map { |year| year.reject { |scale| scale[2] > 0 || scale[1].starts_with?('a-') } }
|
||||
pp output
|
||||
end
|
||||
|
||||
desc 'list survey_items that have no survey responses by district'
|
||||
task list_survey_items_that_lack_responses: :environment do
|
||||
output = AcademicYear.all.map do |academic_year|
|
||||
District.all.map do |district|
|
||||
SurveyItem.all.map do |survey_item|
|
||||
[academic_year.range, survey_item.survey_item_id,
|
||||
survey_item.survey_item_responses.joins(:school).where("school.district": district, academic_year:).count, district.name]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
output = output.map do |year|
|
||||
year.map do |district|
|
||||
district.reject do |survey_item|
|
||||
survey_item[2] > 0 || survey_item[1].starts_with?('a-')
|
||||
end
|
||||
end
|
||||
end
|
||||
pp output
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue