mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
show all years
This commit is contained in:
parent
d324d53bd2
commit
c557adab5a
1 changed files with 5 additions and 5 deletions
|
|
@ -10,17 +10,17 @@ class SchoolsController < ApplicationController
|
|||
@district = @school.district
|
||||
authenticate(@district.name.downcase, "#{@district.name.downcase}!")
|
||||
|
||||
@years = [2017, 2018, 2019]
|
||||
@year = (params[:year] || @years.last).to_i
|
||||
|
||||
if @district.name == "Boston"
|
||||
@categories = Category.joins(:questions)
|
||||
@school_categories = SchoolCategory.where(school: @school).where(category: @categories).to_a
|
||||
@school_categories = SchoolCategory.where(school: @school).where(category: @categories).in(@year).to_a
|
||||
else
|
||||
@categories = Category.root
|
||||
@school_categories = @school.school_categories.for_parent_category(@school, nil).valid.sort
|
||||
@school_categories = @school.school_categories.for_parent_category(@school, nil).valid.in(@year).sort
|
||||
end
|
||||
|
||||
@years = @school_categories.map(&:year).map(&:to_i).sort.uniq
|
||||
@year = (params[:year] || @years.last || "2019").to_i
|
||||
|
||||
missing_categories = @categories - @school_categories.map(&:category)
|
||||
missing_categories.each do |category|
|
||||
@school_categories << category.school_categories.new(school: @school, year: @year)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue