mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-09 07:28:41 -07:00
fixing bug with aggregating school categories
This commit is contained in:
parent
56157a612d
commit
d6ef6cd037
1 changed files with 1 additions and 3 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue