diff --git a/app/controllers/exports_controller.rb b/app/controllers/exports_controller.rb index 4c31298a..1186b206 100644 --- a/app/controllers/exports_controller.rb +++ b/app/controllers/exports_controller.rb @@ -25,14 +25,17 @@ class ExportsController < ApplicationController format.csv do year_params = params.select { |param| param.start_with?("academic_year") }.values academic_years = AcademicYear.where(range: year_params) + group = params["school_group"] - if params["school_group"] == "district" + if group == "district" district_id ||= params[:district]&.to_i if params[:district].present? district = District.find(district_id) if district_id.present? district ||= District.first schools = district.schools - else + elsif group == "school" schools = [School.find_by_name(params["school"])] + elsif group == "all" + schools = School.all end report = params[:report] diff --git a/app/views/exports/index.html.erb b/app/views/exports/index.html.erb index 9d1611b4..ce1c4365 100644 --- a/app/views/exports/index.html.erb +++ b/app/views/exports/index.html.erb @@ -20,6 +20,8 @@

Grouped By

+ > +
>
>