mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
Move raw_response_rate method down to student/teacher classes
This commit is contained in:
parent
5d07f06a65
commit
bdb9455919
3 changed files with 22 additions and 19 deletions
|
|
@ -39,10 +39,6 @@ class ResponseRateCalculator
|
||||||
Survey.find_by(school:, academic_year:)
|
Survey.find_by(school:, academic_year:)
|
||||||
end
|
end
|
||||||
|
|
||||||
def raw_response_rate
|
|
||||||
(average_responses_per_survey_item / total_possible_responses.to_f * 100).round
|
|
||||||
end
|
|
||||||
|
|
||||||
def average_responses_per_survey_item
|
def average_responses_per_survey_item
|
||||||
response_count / survey_item_count.to_f
|
response_count / survey_item_count.to_f
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,26 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class StudentResponseRateCalculator < ResponseRateCalculator
|
class StudentResponseRateCalculator < ResponseRateCalculator
|
||||||
def rate; end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# def rate
|
def raw_response_rate
|
||||||
# check to see if enrollment data is available
|
# def rate
|
||||||
# if not, run the dese loader to get the data
|
# check to see if enrollment data is available
|
||||||
# then upload the enrollment data into the db
|
# if not, run the dese loader to get the data
|
||||||
#
|
# then upload the enrollment data into the db
|
||||||
# if you still don't see enrollment for the school, raise an error and return 100 from this method
|
#
|
||||||
#
|
# if you still don't see enrollment for the school, raise an error and return 100 from this method
|
||||||
# Get the enrollment information from the db
|
#
|
||||||
# Get the list of all grades
|
# Get the enrollment information from the db
|
||||||
# For each grade, get the survey items with data
|
# Get the list of all grades
|
||||||
#
|
# For each grade, get the survey items with data
|
||||||
#
|
#
|
||||||
# All methods below will need to specify a grade
|
#
|
||||||
|
# All methods below will need to specify a grade
|
||||||
|
|
||||||
|
(average_responses_per_survey_item / total_possible_responses.to_f * 100).round
|
||||||
|
end
|
||||||
|
|
||||||
def survey_item_count
|
def survey_item_count
|
||||||
@survey_item_count ||= begin
|
@survey_item_count ||= begin
|
||||||
survey_items = SurveyItem.includes(%i[scale
|
survey_items = SurveyItem.includes(%i[scale
|
||||||
|
|
|
||||||
|
|
@ -26,4 +26,8 @@ class TeacherResponseRateCalculator < ResponseRateCalculator
|
||||||
total_responses.total_teachers
|
total_responses.total_teachers
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def raw_response_rate
|
||||||
|
(average_responses_per_survey_item / total_possible_responses.to_f * 100).round
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue