mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
fix: add response rate method back in to make sure student data gets included in report
This commit is contained in:
parent
610200de9f
commit
ef4780730c
3 changed files with 23 additions and 12 deletions
|
|
@ -1 +1 @@
|
||||||
3.3.6
|
3.4.1
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,7 @@ GEM
|
||||||
activerecord (>= 4.0.0)
|
activerecord (>= 4.0.0)
|
||||||
globalid (1.2.1)
|
globalid (1.2.1)
|
||||||
activesupport (>= 6.1)
|
activesupport (>= 6.1)
|
||||||
google-protobuf (4.28.2-x86_64-linux)
|
google-protobuf (4.28.2)
|
||||||
bigdecimal
|
bigdecimal
|
||||||
rake (>= 13)
|
rake (>= 13)
|
||||||
guard (2.18.1)
|
guard (2.18.1)
|
||||||
|
|
@ -246,6 +246,7 @@ GEM
|
||||||
matrix (0.4.2)
|
matrix (0.4.2)
|
||||||
method_source (1.0.0)
|
method_source (1.0.0)
|
||||||
mini_mime (1.1.5)
|
mini_mime (1.1.5)
|
||||||
|
mini_portile2 (2.8.8)
|
||||||
minitest (5.25.1)
|
minitest (5.25.1)
|
||||||
msgpack (1.7.2)
|
msgpack (1.7.2)
|
||||||
multi_json (1.15.0)
|
multi_json (1.15.0)
|
||||||
|
|
@ -266,7 +267,8 @@ GEM
|
||||||
newrelic_rpm (9.6.0)
|
newrelic_rpm (9.6.0)
|
||||||
base64
|
base64
|
||||||
nio4r (2.7.3)
|
nio4r (2.7.3)
|
||||||
nokogiri (1.16.7-x86_64-linux)
|
nokogiri (1.16.7)
|
||||||
|
mini_portile2 (~> 2.8.2)
|
||||||
racc (~> 1.4)
|
racc (~> 1.4)
|
||||||
notiffany (0.1.3)
|
notiffany (0.1.3)
|
||||||
nenv (~> 0.1)
|
nenv (~> 0.1)
|
||||||
|
|
@ -551,7 +553,7 @@ DEPENDENCIES
|
||||||
watir
|
watir
|
||||||
|
|
||||||
RUBY VERSION
|
RUBY VERSION
|
||||||
ruby 3.3.6p108
|
ruby 3.4.1p0
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.5.11
|
2.5.11
|
||||||
|
|
|
||||||
|
|
@ -61,13 +61,13 @@ module Report
|
||||||
data << headers
|
data << headers
|
||||||
|
|
||||||
survey_items_by_id = ::SurveyItem.by_id_includes_all
|
survey_items_by_id = ::SurveyItem.by_id_includes_all
|
||||||
|
|
||||||
|
mutex = Thread::Mutex.new
|
||||||
|
pool_size = 2
|
||||||
|
jobs = Queue.new
|
||||||
|
schools.each { |school| jobs << school }
|
||||||
|
|
||||||
academic_years.each do |academic_year|
|
academic_years.each do |academic_year|
|
||||||
mutex = Thread::Mutex.new
|
|
||||||
|
|
||||||
pool_size = 2
|
|
||||||
jobs = Queue.new
|
|
||||||
schools.each { |school| jobs << school }
|
|
||||||
|
|
||||||
workers = pool_size.times.map do
|
workers = pool_size.times.map do
|
||||||
Thread.new do
|
Thread.new do
|
||||||
while school = jobs.pop(true)
|
while school = jobs.pop(true)
|
||||||
|
|
@ -108,8 +108,8 @@ module Report
|
||||||
row.concat(padding)
|
row.concat(padding)
|
||||||
|
|
||||||
# filter out response rate at subcategory level <24.5% for school average
|
# filter out response rate at subcategory level <24.5% for school average
|
||||||
if ::StudentResponseRateCalculator.new(subcategory: survey_item.subcategory, school:,
|
if response_rate(subcategory: survey_item.subcategory, school:,
|
||||||
academic_year:).meets_student_threshold?
|
academic_year:).meets_student_threshold?
|
||||||
row.append("#{survey_item.survey_item_responses.where(
|
row.append("#{survey_item.survey_item_responses.where(
|
||||||
# We allow the nil (unknown) grades in the school survey item average
|
# We allow the nil (unknown) grades in the school survey item average
|
||||||
# also filter less than 10 responses in the whole school
|
# also filter less than 10 responses in the whole school
|
||||||
|
|
@ -154,6 +154,15 @@ module Report
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.response_rate(subcategory:, school:, academic_year:)
|
||||||
|
@response_rate ||= Hash.new do |memo, (subcategory, school, academic_year)|
|
||||||
|
memo[[subcategory, school, academic_year]] =
|
||||||
|
::StudentResponseRateCalculator.new(subcategory:, school:, academic_year:)
|
||||||
|
end
|
||||||
|
|
||||||
|
@response_rate[[subcategory, school, academic_year]]
|
||||||
|
end
|
||||||
|
|
||||||
def self.write_csv(csv:, filepath:)
|
def self.write_csv(csv:, filepath:)
|
||||||
File.write(filepath, csv)
|
File.write(filepath, csv)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue