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:
rebuilt 2022-02-16 20:40:32 +01:00
parent 1ca88bf6d1
commit d4df7cbc06
44 changed files with 1053 additions and 856 deletions

View file

@ -1,30 +1,30 @@
require 'rails_helper'
describe Scale do
describe Zones do
describe '#zone_for_score' do
let(:scale) do
Scale.new watch_low_benchmark: 1.5, growth_low_benchmark: 2.5, approval_low_benchmark: 3.5,
let(:zones) do
Zones.new watch_low_benchmark: 1.5, growth_low_benchmark: 2.5, approval_low_benchmark: 3.5,
ideal_low_benchmark: 4.5
end
context 'when the score is 1.0' do
it 'returns the warning zone' do
expect(scale.zone_for_score(1.0)).to eq scale.warning_zone
expect(zones.zone_for_score(1.0)).to eq zones.warning_zone
end
end
context 'when the score is 5.0' do
it 'returns the ideal zone' do
expect(scale.zone_for_score(5.0)).to eq scale.ideal_zone
expect(zones.zone_for_score(5.0)).to eq zones.ideal_zone
end
end
context 'when the score is right on the benchmark' do
it 'returns the higher zone' do
expect(scale.zone_for_score(1.5)).to eq scale.watch_zone
expect(scale.zone_for_score(2.5)).to eq scale.growth_zone
expect(scale.zone_for_score(3.5)).to eq scale.approval_zone
expect(scale.zone_for_score(4.5)).to eq scale.ideal_zone
expect(zones.zone_for_score(1.5)).to eq zones.watch_zone
expect(zones.zone_for_score(2.5)).to eq zones.growth_zone
expect(zones.zone_for_score(3.5)).to eq zones.approval_zone
expect(zones.zone_for_score(4.5)).to eq zones.ideal_zone
end
end
end