chore: refactor teacher response rate

rpp-main
Nelson Jovel 2 years ago
parent af82f6999a
commit 6bea0bc2d0

@ -10,15 +10,9 @@ class TeacherResponseRateCalculator < ResponseRateCalculator
end end
def survey_items_with_sufficient_responses def survey_items_with_sufficient_responses
@survey_items_with_sufficient_responses ||= {}.tap do |hash| @survey_items_with_sufficient_responses ||= SurveyItemResponse.teacher_survey_items_with_sufficient_responses(
@subcategory.survey_items.teacher_survey_items.map do |survey_item| school:, academic_year:
si = SurveyItemResponse.teacher_survey_items_with_sufficient_responses(school:, academic_year:) ).slice(*@subcategory.survey_items.teacher_survey_items.map(&:id))
count = si[survey_item.id]
next unless count
hash[survey_item.id] = count
end
end
end end
def response_count def response_count

Loading…
Cancel
Save