mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
finish up adding socio economic disag filter
This commit is contained in:
parent
a258b32b39
commit
cab0a3955e
11 changed files with 139 additions and 12 deletions
|
|
@ -17,7 +17,7 @@ class Benefit < ApplicationRecord
|
|||
puts "************************************"
|
||||
puts "******** ERROR **********"
|
||||
puts ""
|
||||
puts "Error parsing Income column. '#{benefits}' is not a known value. Halting execution"
|
||||
puts "Error parsing benefits column. '#{benefits}' is not a known value. Halting execution"
|
||||
puts ""
|
||||
puts "************************************"
|
||||
exit
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class Education < ApplicationRecord
|
|||
puts "************************************"
|
||||
puts "******** ERROR **********"
|
||||
puts ""
|
||||
puts "Error parsing Income column. '#{education}' is not a known value. Halting execution"
|
||||
puts "Error parsing Education column. '#{education}' is not a known value. Halting execution"
|
||||
puts ""
|
||||
puts "************************************"
|
||||
exit
|
||||
|
|
|
|||
|
|
@ -5,23 +5,23 @@ class Employment < ApplicationRecord
|
|||
return "Unknown" if employment.blank? or employment.nil?
|
||||
|
||||
case employment
|
||||
in /^1$/i
|
||||
in /^1$|^1100$/i
|
||||
"Two adults with full-time employment"
|
||||
in /^2$/i
|
||||
in /^2$|^2100$/i
|
||||
"One adult with full-time employment"
|
||||
in /^3$/i
|
||||
in /^3$|^3100$/i
|
||||
"Two adults with part-time employment"
|
||||
in /^4$/i
|
||||
in /^4$|^4100$/i
|
||||
"One adult with part-time employment"
|
||||
in /^5$/i
|
||||
in /^5$|^5100$/i
|
||||
"No full-time or part-time employment"
|
||||
in /^99$|^100$/i
|
||||
in /^99$|^100$|^99100$/i
|
||||
"Unknown"
|
||||
else
|
||||
puts "************************************"
|
||||
puts "******** ERROR **********"
|
||||
puts ""
|
||||
puts "Error parsing Income column. '#{employment}' is not a known value. Halting execution"
|
||||
puts "Error parsing Employment column. '#{employment}' is not a known value. Halting execution"
|
||||
puts ""
|
||||
puts "************************************"
|
||||
exit
|
||||
|
|
|
|||
|
|
@ -75,6 +75,10 @@ class SurveyItemResponse < ActiveRecord::Base
|
|||
SurveyItemResponse.joins([parent: :languages]).where(languages: { designation: designations }, survey_item: survey_items, school:, academic_year:).group(:survey_item).average(:likert_score)
|
||||
}
|
||||
|
||||
scope :averages_for_socio_economic_status, lambda { |survey_items, school, academic_year, socio_economic_status|
|
||||
SurveyItemResponse.joins(:parent).where(parent: { socio_economic_status: }, survey_item: survey_items, school:, academic_year:).group(:survey_item).average(:likert_score)
|
||||
}
|
||||
|
||||
def self.grouped_responses(school:, academic_year:)
|
||||
@grouped_responses ||= Hash.new do |memo, (school, academic_year)|
|
||||
memo[[school, academic_year]] =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue