mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
average those groupings and the way up the framework. Likert scores for a survey_item are averaged. Then all the survey_items in a scale are averaged. Then student scales in a measure are averaged. And teacher scales in a measure are averaged. Then the average of those two calculations becomes the score for a measure. Then the measures in a subcategory are averaged.
26 lines
766 B
Ruby
26 lines
766 B
Ruby
class StudentResponseRate
|
|
include ResponseRate
|
|
|
|
private
|
|
|
|
def survey_item_count
|
|
@student_survey_item_count ||= @subcategory.measures.map { |measure| measure.student_survey_items.count }.sum
|
|
end
|
|
|
|
def response_count
|
|
@student_response_count ||= @subcategory.measures.map do |measure|
|
|
measure.student_survey_items.map do |survey_item|
|
|
survey_item.survey_item_responses.where(school: @school, academic_year: @academic_year).count
|
|
end.sum
|
|
end.sum
|
|
end
|
|
|
|
def total_possible_responses
|
|
@total_possible_student_responses ||= begin
|
|
total_responses = Respondent.where(school: @school, academic_year: @academic_year).first
|
|
return 0 unless total_responses.present?
|
|
|
|
total_responses.total_students
|
|
end
|
|
end
|
|
end
|