mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
feat: Add 'all school' option to exports page
This commit is contained in:
parent
aee0bc9883
commit
2eb42800f6
2 changed files with 7 additions and 2 deletions
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
<h3 class="sub-header-4 mt-5">Grouped By</h3>
|
||||
<div class="mt-3">
|
||||
<input type="radio" id="all" name="school_group" value="all" <%= @schools_grouped_by == "all" ? "checked" : "" %>>
|
||||
<label for="all">All Schools (No Grouping)</label><br>
|
||||
<input type="radio" id="by_district" name="school_group" value="district" <%= @schools_grouped_by == "district" ? "checked" : "" %>>
|
||||
<label for="by_district">District</label><br>
|
||||
<input type="radio" id="by_school" name="school_group" value="school" <%= @schools_grouped_by == "school" ? "checked" : "" %>>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue