mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-11 00:10:35 -07:00
Add scales to framework. Change calculations to first group and then
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.
This commit is contained in:
parent
1ca88bf6d1
commit
d4df7cbc06
44 changed files with 1053 additions and 856 deletions
41
spec/models/scale_spec.rb
Normal file
41
spec/models/scale_spec.rb
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Scale, type: :model do
|
||||
let(:school) { create(:school) }
|
||||
let(:academic_year) { create(:academic_year) }
|
||||
let(:scale) { create(:scale) }
|
||||
|
||||
describe '.score' do
|
||||
let(:teacher_survey_item_1) { create(:teacher_survey_item, scale:) }
|
||||
let(:teacher_survey_item_2) { create(:teacher_survey_item, scale:) }
|
||||
let(:teacher_survey_item_3) { create(:teacher_survey_item, scale:) }
|
||||
|
||||
before :each do
|
||||
create(:survey_item_response,
|
||||
survey_item: teacher_survey_item_1, academic_year:, school:, likert_score: 3)
|
||||
create(:survey_item_response,
|
||||
survey_item: teacher_survey_item_2, academic_year:, school:, likert_score: 4)
|
||||
create(:survey_item_response,
|
||||
survey_item: teacher_survey_item_3, academic_year:, school:, likert_score: 5)
|
||||
end
|
||||
|
||||
it 'returns the average of the likert scores of the survey items' do
|
||||
expect(scale.score(school:, academic_year:)).to eq 4
|
||||
end
|
||||
|
||||
context 'when other scales exist' do
|
||||
before :each do
|
||||
create(:survey_item_response,
|
||||
academic_year:, school:, likert_score: 1)
|
||||
create(:survey_item_response,
|
||||
academic_year:, school:, likert_score: 1)
|
||||
create(:survey_item_response,
|
||||
academic_year:, school:, likert_score: 1)
|
||||
end
|
||||
|
||||
it 'does not affect the score for the original scale' do
|
||||
expect(scale.score(school:, academic_year:)).to eq 4
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue