fixing bug with aggregating school categories

pull/1/head
Jared Cosulich 7 years ago
parent 56157a612d
commit d6ef6cd037

@ -55,14 +55,12 @@ class SchoolCategory < ApplicationRecord
return {} if child_school_categories.blank?
average_zscore = nil
zscore_categories = child_school_categories.select { |csc| csc.zscore.present? }
zscore_categories = child_school_categories.select { |csc| csc.zscore.present? && !csc.zscore.nan? }
if zscore_categories.length > 0
total_zscore = zscore_categories.inject(0) { |total, zc| total + zc.zscore }
average_zscore = total_zscore / zscore_categories.length
end
return {
attempt_count:
_aggregated_responses[:attempt_count] +

Loading…
Cancel
Save