mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-08 23:18:18 -07:00
checkbox change. Draw bar graphs for each academic year selected. Center bar graphs in their column. Color the columns to match the sample colors on the checkboxes. Add scores on beta to top of graph. Automatically display the most recent year of data for the district. Modify logic for the insufficient data message or the 'measure not based on student/teacher surveys' message so it only shows if there are no bars with data to display.
29 lines
916 B
Ruby
29 lines
916 B
Ruby
class Subcategory < ActiveRecord::Base
|
|
belongs_to :category
|
|
|
|
has_many :measures
|
|
|
|
def score(school:, academic_year:)
|
|
scores = measures.includes([:survey_items]).map do |measure|
|
|
measure.score(school:, academic_year:).average
|
|
end
|
|
scores = scores.reject(&:nil?)
|
|
scores.average
|
|
end
|
|
|
|
def student_response_rate(school:, academic_year:)
|
|
@student_response_rate ||= Hash.new do |memo, (school, academic_year)|
|
|
memo[[school, academic_year]] = StudentResponseRate.new(subcategory: self, school:, academic_year:)
|
|
end
|
|
|
|
@student_response_rate[[school, academic_year]]
|
|
end
|
|
|
|
def teacher_response_rate(school:, academic_year:)
|
|
@teacher_response_rate ||= Hash.new do |memo, (school, academic_year)|
|
|
memo[[school, academic_year]] = TeacherResponseRate.new(subcategory: self, school:, academic_year:)
|
|
end
|
|
|
|
@teacher_response_rate[[school, academic_year]]
|
|
end
|
|
end
|