mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
Add placeholder for testing response rate calculation
This commit is contained in:
parent
417a3523ec
commit
eb043f2b2d
2 changed files with 19 additions and 0 deletions
|
|
@ -18,6 +18,9 @@ class StudentResponseRateCalculator < ResponseRateCalculator
|
|||
#
|
||||
# All methods below will need to specify a grade
|
||||
|
||||
grades_with_sufficient_responses.map do |grade|
|
||||
puts "Grade: #{grade}"
|
||||
end
|
||||
(average_responses_per_survey_item / total_possible_responses.to_f * 100).round
|
||||
end
|
||||
|
||||
|
|
@ -52,4 +55,15 @@ class StudentResponseRateCalculator < ResponseRateCalculator
|
|||
total_responses.total_students
|
||||
end
|
||||
end
|
||||
|
||||
def grades_with_sufficient_responses
|
||||
SurveyItemResponse.where(school:, academic_year:,
|
||||
survey_item: subcategory.survey_items.student_survey_items).where.not(grade: nil)
|
||||
.group(:grade)
|
||||
.select(:response_id)
|
||||
.distinct(:response_id)
|
||||
.count.reject do |_key, value|
|
||||
value < 10
|
||||
end.keys
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -18,6 +18,11 @@ describe ResponseRateCalculator, type: :model do
|
|||
let(:insufficient_student_survey_item_1) { create(:student_survey_item, scale: sufficient_scale_1) }
|
||||
let(:sufficient_student_survey_item_2) { create(:student_survey_item, scale: sufficient_scale_2) }
|
||||
|
||||
context '.grades_with_sufficient_responses' do
|
||||
pending 'implement this'
|
||||
before :each do
|
||||
end
|
||||
end
|
||||
context 'when a students take a regular survey' do
|
||||
context 'when the average number of student responses per question in a subcategory is equal to the student response threshold' do
|
||||
before :each do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue