mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-13 09:20:38 -07:00
always show all categories
This commit is contained in:
parent
7b3ab8c592
commit
fa80643770
2 changed files with 9 additions and 2 deletions
|
|
@ -14,11 +14,18 @@ class CategoriesController < ApplicationController
|
|||
district = @school.district
|
||||
authenticate(district.name.downcase, "#{district.name.downcase}!")
|
||||
school_categories = SchoolCategory.for(@school, @category)
|
||||
if school_categories.empty?
|
||||
school_categories = [SchoolCategory.new(school: @school, category: @category, year: @year)]
|
||||
end
|
||||
@years = school_categories.map(&:year).map(&:to_i).sort
|
||||
@year = (params[:year] || @years.first).to_i
|
||||
@years.delete(@year)
|
||||
@school_category = school_categories.in(@year).first
|
||||
@child_school_categories = SchoolCategory.for_parent_category(@school, @category).in(@year).valid
|
||||
@child_school_categories = SchoolCategory.for_parent_category(@school, @category).in(@year).valid.to_a
|
||||
missing_categories = Category.for_parent(@category) - @child_school_categories.map(&:category)
|
||||
missing_categories.each do |category|
|
||||
@child_school_categories << category.school_categories.new(school: @school)
|
||||
end
|
||||
@questions = @category.questions.created_in(@year)
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue