You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
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
|
|
end
|