Rename ResponseRate to ResponseRateCalculator. Create a new response

rate model.  Create a loader to refresh response rates for all
subcategories.

Use precalculated response rates in views

Wrap more elements in page caching

Calculate a response rate for a subcategory if one does not already
exist
This commit is contained in:
rebuilt 2022-06-15 09:35:13 -07:00
parent dfc5202b88
commit c03615cb43
16 changed files with 352 additions and 177 deletions

View file

@ -74,7 +74,8 @@ module AnalyzeHelper
def empty_dataset?(measures:, school:, academic_year:)
@empty_dataset ||= Hash.new do |memo, (school, academic_year)|
memo[[school, academic_year]] = measures.all? do |measure|
measure.survey_item_responses.where(school:, academic_year:).none? || measure.none_meet_threshold?(school:, academic_year:)
response_rate = measure.subcategory.response_rate(school:, academic_year:)
!response_rate.meets_student_threshold && !response_rate.meets_teacher_threshold
end
end