mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-09 07:28:41 -07:00
Merge branch 'mciea' of https://github.com/jaredcosulich/edcontext into CustomZones
This commit is contained in:
commit
029dfdf10e
3 changed files with 8 additions and 10 deletions
|
|
@ -37,13 +37,11 @@ class SchoolCategory < ApplicationRecord
|
|||
SchoolCategory.for(school, cc).valid
|
||||
end.flatten.compact
|
||||
|
||||
new_zscore = zscore
|
||||
if new_zscore.nil?
|
||||
zscore_categories = child_school_categories.select { |csc| csc.zscore.present? }
|
||||
if zscore_categories.length > 0
|
||||
total_zscore = zscore_categories.inject(0) { |total, zc| total + zc.zscore }
|
||||
new_zscore = total_zscore / zscore_categories.length
|
||||
end
|
||||
average_zscore = nil
|
||||
zscore_categories = child_school_categories.select { |csc| csc.zscore.present? }
|
||||
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 {
|
||||
|
|
@ -56,7 +54,7 @@ class SchoolCategory < ApplicationRecord
|
|||
answer_index_total:
|
||||
_aggregated_responses[:answer_index_total] +
|
||||
child_school_categories.inject(0) { |total, csc| total + csc.answer_index_total },
|
||||
zscore: new_zscore
|
||||
zscore: average_zscore.present? ? average_zscore : zscore
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
= "(Benchmark: #{@school_category.category.benchmark})"
|
||||
|
||||
- if @school_category.zscore.present?
|
||||
= [(@school_category.zscore.round(1) + 3), 5].min
|
||||
= @school_category.zscore.round(1) + 3
|
||||
(out of 5)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -282,7 +282,7 @@ namespace :data do
|
|||
school_category = school.school_categories.find_or_create_by(category: nonlikert_category)
|
||||
school_category.update(
|
||||
nonlikert: row["NL_Value"],
|
||||
zscore: row["Z-Score"]
|
||||
zscore: [row["Z-Score"].to_f,2].min
|
||||
)
|
||||
school_category_id = school_category.id
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue