mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-11 00:10:35 -07:00
new boston view
This commit is contained in:
parent
f4542c7a20
commit
07d3175761
3 changed files with 15 additions and 4 deletions
|
|
@ -7,16 +7,22 @@ class SchoolsController < ApplicationController
|
|||
# GET /schools/1
|
||||
# GET /schools/1.json
|
||||
def show
|
||||
district = @school.district
|
||||
authenticate(district.name.downcase, "#{district.name.downcase}!")
|
||||
@district = @school.district
|
||||
authenticate(@district.name.downcase, "#{@district.name.downcase}!")
|
||||
|
||||
@school_categories = @school.school_categories.for_parent_category(@school, nil).valid.sort
|
||||
if @district.name == "Boston"
|
||||
@categories = Category.joins(:questions)
|
||||
@school_categories = SchoolCategory.where(school: @school).where(category: @categories).to_a
|
||||
else
|
||||
@categories = Category.root
|
||||
@school_categories = @school.school_categories.for_parent_category(@school, nil).valid.sort
|
||||
end
|
||||
|
||||
@years = @school_categories.map(&:year).map(&:to_i).sort.uniq
|
||||
@year = (params[:year] || @years.last || "2018").to_i
|
||||
@years.delete(@year)
|
||||
|
||||
missing_categories = Category.root - @school_categories.map(&:category)
|
||||
missing_categories = @categories - @school_categories.map(&:category)
|
||||
missing_categories.each do |category|
|
||||
@school_categories << category.school_categories.new(school: @school, year: @year)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue