fix: ECP-124 Update grade range to be the union of grades found in the database and the enrollment of the school. "Subcategory - School & District"

# Fixed reported grades
	     # Runs faster
      "Measure - District only"
	      # Should only be run per district
	      # Runs faster
	      # Fixed reported grades
      "Measure - School & District"
	      # Reports the grades that took the survey for that school+year; not the grades that responded to the measure
	      # Runs faster
	      # Fixed reported grades
      "Beyond Learning Loss"
      		# Runs faster
      "Beyond Learning Loss - Response Rate"
      		# Fixed reported grades
      "Survey Item - By Item"
	      # may be able to speed it up by getting all averages in a single request
	      # Fixed reported grades
      "Survey Item - By Grade"
      		# Fixed reported grades
	      #may be able to speed it up by getting all averages in a single request
      "Survey Entries - by Measure"
      		# No changes
This commit is contained in:
rebuilt 2025-04-29 11:06:38 -07:00
parent 0f457becf0
commit 058cbb0f6e
9 changed files with 55 additions and 65 deletions

View file

@ -30,7 +30,7 @@ class ExportsController < ApplicationController
report = params[:report]
if ["Survey Item - By Item", "Survey Item - By Grade", "Survey Entries - by Measure"].include?(report)
use_student_survey_items = student_survey_types[params[:student_survey_type]]
use_student_survey_items = student_survey_types[params[:student_survey_type]] || ::SurveyItem.student_survey_items.pluck(:id)
reports[report].call(schools, academic_years, use_student_survey_items)
else
reports[report].call(schools, academic_years)
@ -88,8 +88,7 @@ class ExportsController < ApplicationController
filename: "beyond_learning_loss_response_rate_#{Date.today}.csv"
},
"Survey Item - By Item" => lambda { |schools, academic_years, use_student_survey_items|
data = Report::SurveyItemByItem.to_csv(schools:, academic_years:,
use_student_survey_items:)
data = Report::SurveyItemByItem.to_csv(schools:, academic_years:, use_student_survey_items:)
send_data data, disposition: "attachment",
filename: "survey_item_by_item_#{Date.today}.csv"
},