mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
fixing bug with merging schools
This commit is contained in:
parent
50930ecc62
commit
2dd216ee25
2 changed files with 13 additions and 13 deletions
|
|
@ -62,13 +62,13 @@ class SchoolCategory < ApplicationRecord
|
|||
return {
|
||||
attempt_count:
|
||||
_aggregated_responses[:attempt_count] +
|
||||
child_school_categories.inject(0) { |total, csc| total + csc.attempt_count },
|
||||
child_school_categories.inject(0) { |total, csc| total + csc.attempt_count || 0 },
|
||||
response_count:
|
||||
_aggregated_responses[:response_count] +
|
||||
child_school_categories.inject(0) { |total, csc| total + csc.response_count },
|
||||
child_school_categories.inject(0) { |total, csc| total + csc.response_count || 0 },
|
||||
answer_index_total:
|
||||
_aggregated_responses[:answer_index_total] +
|
||||
child_school_categories.inject(0) { |total, csc| total + csc.answer_index_total },
|
||||
child_school_categories.inject(0) { |total, csc| total + csc.answer_index_total || 0 },
|
||||
zscore: average_zscore.present? ? average_zscore : _aggregated_responses[:zscore]
|
||||
}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -383,16 +383,16 @@ namespace :data do
|
|||
)
|
||||
end
|
||||
|
||||
pc = nonlikert_category.parent_category
|
||||
while pc != nil
|
||||
psc = SchoolCategory.for(school, pc).in(school_category.year).first
|
||||
if psc != nil
|
||||
psc.update(valid_child_count: (psc.valid_child_count || 0) + 1)
|
||||
pc = pc.parent_category
|
||||
else
|
||||
pc = nil
|
||||
end
|
||||
end
|
||||
# pc = nonlikert_category.parent_category
|
||||
# while pc != nil
|
||||
# psc = SchoolCategory.for(school, pc).in(school_category.year).first
|
||||
# if psc != nil
|
||||
# psc.update(valid_child_count: (psc.valid_child_count || 0) + 1)
|
||||
# pc = pc.parent_category
|
||||
# else
|
||||
# pc = nil
|
||||
# end
|
||||
# end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue