mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-11 08:21:12 -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
|
||||
|
|
|
|||
|
|
@ -83,6 +83,8 @@ class SchoolCategory < ApplicationRecord
|
|||
end
|
||||
|
||||
def sync_aggregated_responses
|
||||
# This doesn't seem to be taking into account valid_child_count or Boston's "Community and Wellbeing" category which should be suppressed if the "Health" category is the only child category visible.
|
||||
|
||||
return if ENV['BULK_PROCESS']
|
||||
update_attributes(chained_aggregated_responses)
|
||||
return if response_count == 0 && zscore.nil?
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@
|
|||
.col-12.text-center
|
||||
%h3 Insufficient Responses
|
||||
%p No data is displayed for this school because of insufficient responses.
|
||||
- elsif @district.name == "Boston"
|
||||
.row
|
||||
= render @school_categories.sort { |a, b| a.category.name <=> b.category.name }
|
||||
- else
|
||||
.row
|
||||
= render @school_categories.sort { |a, b| a.root_index <=> b.root_index }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue