From 93b0267dadeff8c11806d773fbc158778ac23ecb Mon Sep 17 00:00:00 2001 From: Jared Cosulich Date: Sun, 3 Mar 2019 17:07:29 -0500 Subject: [PATCH] remove boston admin categories --- app/controllers/categories_controller.rb | 5 +++++ app/models/school_category.rb | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb index a47942ef..08bc69fb 100644 --- a/app/controllers/categories_controller.rb +++ b/app/controllers/categories_controller.rb @@ -30,6 +30,11 @@ class CategoriesController < ApplicationController next if category.benchmark.present? @child_school_categories << category.school_categories.new(school: @school) end + + if district.name == "Boston" + @child_school_categories = @child_school_categories.reject { |csc| csc.admin? } + end + @questions = @category.questions.created_in(@year) end diff --git a/app/models/school_category.rb b/app/models/school_category.rb index fe89c989..0d67babd 100644 --- a/app/models/school_category.rb +++ b/app/models/school_category.rb @@ -16,6 +16,11 @@ class SchoolCategory < ApplicationRecord scope :valid, -> { where("zscore is not null or valid_child_count is not null") } + def admin? + category.child_categories.each { |cc| return false if cc.benchmark.blank? } + return true + end + def root_index category.root_index end