diff --git a/app/models/response_rate_calculator.rb b/app/models/response_rate_calculator.rb index ba84c8b5..61276e44 100644 --- a/app/models/response_rate_calculator.rb +++ b/app/models/response_rate_calculator.rb @@ -39,10 +39,6 @@ class ResponseRateCalculator Survey.find_by(school:, academic_year:) end - def raw_response_rate - (average_responses_per_survey_item / total_possible_responses.to_f * 100).round - end - def average_responses_per_survey_item response_count / survey_item_count.to_f end diff --git a/app/models/student_response_rate_calculator.rb b/app/models/student_response_rate_calculator.rb index cbf2024e..cd05551a 100644 --- a/app/models/student_response_rate_calculator.rb +++ b/app/models/student_response_rate_calculator.rb @@ -1,23 +1,26 @@ # frozen_string_literal: true class StudentResponseRateCalculator < ResponseRateCalculator - def rate; end - private - # def rate - # check to see if enrollment data is available - # 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 - # - # Get the enrollment information from the db - # Get the list of all grades - # For each grade, get the survey items with data - # - # - # All methods below will need to specify a grade + def raw_response_rate + # def rate + # check to see if enrollment data is available + # 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 + # + # Get the enrollment information from the db + # Get the list of all grades + # For each grade, get the survey items with data + # + # + # 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 @survey_item_count ||= begin survey_items = SurveyItem.includes(%i[scale diff --git a/app/models/teacher_response_rate_calculator.rb b/app/models/teacher_response_rate_calculator.rb index 9c7bff70..588d0d16 100644 --- a/app/models/teacher_response_rate_calculator.rb +++ b/app/models/teacher_response_rate_calculator.rb @@ -26,4 +26,8 @@ class TeacherResponseRateCalculator < ResponseRateCalculator total_responses.total_teachers end end + + def raw_response_rate + (average_responses_per_survey_item / total_possible_responses.to_f * 100).round + end end