mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08: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
|
|
@ -6,32 +6,36 @@ describe 'categories/show' do
|
|||
school = create(:school, name: 'Best School')
|
||||
|
||||
category = create(:category, name: 'Some Category', description: 'Some description of the category')
|
||||
category_presenter = CategoryPresenter.new(category: category)
|
||||
category_presenter = CategoryPresenter.new(category:)
|
||||
|
||||
subcategory1 = create(:subcategory, category: category, name: 'A subcategory',
|
||||
subcategory1 = create(:subcategory, category:, name: 'A subcategory',
|
||||
description: 'Some description of the subcategory')
|
||||
subcategory2 = create(:subcategory_with_measures, category: category, name: 'Another subcategory',
|
||||
subcategory2 = create(:subcategory_with_measures, category:, name: 'Another subcategory',
|
||||
description: 'Another description of the subcategory')
|
||||
|
||||
measure1 = create(:measure, subcategory: subcategory1)
|
||||
survey_item1 = create(:student_survey_item, measure: measure1, watch_low_benchmark: 1.5, growth_low_benchmark: 2.5,
|
||||
scale1 = create(:student_scale, measure: measure1)
|
||||
survey_item1 = create(:student_survey_item, scale: scale1, watch_low_benchmark: 1.5, growth_low_benchmark: 2.5,
|
||||
approval_low_benchmark: 3.5, ideal_low_benchmark: 4.5)
|
||||
create_list(:survey_item_response, SurveyItemResponse::STUDENT_RESPONSE_THRESHOLD, survey_item: survey_item1,
|
||||
academic_year: academic_year, school: school, likert_score: 1)
|
||||
academic_year:, school:, likert_score: 3)
|
||||
|
||||
measure2 = create(:measure, name: 'The second measure name', description: 'The second measure description',
|
||||
subcategory: subcategory1)
|
||||
student_survey_item = create(:student_survey_item, measure: measure2, prompt: 'Some prompt for student data',
|
||||
subcategory: subcategory2)
|
||||
scale2 = create(:student_scale, measure: measure2)
|
||||
scale3 = create(:teacher_scale, measure: measure2)
|
||||
student_survey_item = create(:student_survey_item, scale: scale2, prompt: 'Some prompt for student data',
|
||||
watch_low_benchmark: 1.5, growth_low_benchmark: 2.5, approval_low_benchmark: 3.5, ideal_low_benchmark: 4.5)
|
||||
create_list(:survey_item_response, SurveyItemResponse::STUDENT_RESPONSE_THRESHOLD,
|
||||
survey_item: student_survey_item, academic_year: academic_year, school: school, likert_score: 5)
|
||||
survey_item: student_survey_item, academic_year:, school:, likert_score: 5)
|
||||
|
||||
teacher_survey_item = create(:teacher_survey_item, measure: measure2, prompt: 'Some prompt for teacher data')
|
||||
teacher_survey_item = create(:teacher_survey_item, scale: scale3, prompt: 'Some prompt for teacher data')
|
||||
create_list(:survey_item_response, SurveyItemResponse::TEACHER_RESPONSE_THRESHOLD,
|
||||
survey_item: teacher_survey_item, academic_year: academic_year, school: school, likert_score: 3)
|
||||
survey_item: teacher_survey_item, academic_year:, school:, likert_score: 3)
|
||||
|
||||
admin_data_item = create(:admin_data_item, measure: measure2, description: 'Some admin data item description',
|
||||
watch_low_benchmark: 1.5, growth_low_benchmark: 2.5, approval_low_benchmark: 3.5, ideal_low_benchmark: 4.5)
|
||||
admin_data_scale = create(:scale, measure: measure2)
|
||||
create(:admin_data_item, scale: admin_data_scale, description: 'Some admin data item description',
|
||||
watch_low_benchmark: 1.5, growth_low_benchmark: 2.5, approval_low_benchmark: 3.5, ideal_low_benchmark: 4.5)
|
||||
assign :category, category_presenter
|
||||
|
||||
assign :categories, [category_presenter]
|
||||
|
|
@ -44,45 +48,45 @@ describe 'categories/show' do
|
|||
end
|
||||
|
||||
it 'renders the category name and description' do
|
||||
expect(rendered).to match /Some Category/
|
||||
expect(rendered).to match /Some description of the category/
|
||||
expect(rendered).to match(/Some Category/)
|
||||
expect(rendered).to match(/Some description of the category/)
|
||||
end
|
||||
|
||||
context 'for each subcategory' do
|
||||
it 'renders the subcategory name' do
|
||||
expect(rendered).to match /A subcategory/
|
||||
expect(rendered).to match /Another subcategory/
|
||||
expect(rendered).to match(/A subcategory/)
|
||||
expect(rendered).to match(/Another subcategory/)
|
||||
end
|
||||
|
||||
it 'renders the subcategory description' do
|
||||
expect(rendered).to match /Some description of the subcategory/
|
||||
expect(rendered).to match /Another description of the subcategory/
|
||||
expect(rendered).to match(/Some description of the subcategory/)
|
||||
expect(rendered).to match(/Another description of the subcategory/)
|
||||
end
|
||||
|
||||
it 'renders the zone title and fill color for the gauge graph' do
|
||||
expect(rendered).to match /Growth/
|
||||
expect(rendered).to match /fill-growth/
|
||||
expect(rendered).to match(/Growth/)
|
||||
expect(rendered).to match(/fill-growth/)
|
||||
end
|
||||
end
|
||||
|
||||
context 'for each measure' do
|
||||
it 'renders the measure name' do
|
||||
expect(rendered).to match /The second measure name/
|
||||
expect(rendered).to match(/The second measure name/)
|
||||
end
|
||||
|
||||
it 'renders the measure description' do
|
||||
expect(rendered).to match /The second measure description/
|
||||
expect(rendered).to match(/The second measure description/)
|
||||
end
|
||||
|
||||
it 'renders a gauge graph and the zone title color' do
|
||||
expect(rendered).to match /Ideal/
|
||||
expect(rendered).to match /fill-ideal/
|
||||
expect(rendered).to match(/Approval/)
|
||||
expect(rendered).to match(/fill-approval/)
|
||||
end
|
||||
|
||||
it 'renders the prompts for survey items and admin data that make up the measure' do
|
||||
expect(rendered).to match /Some prompt for student data/
|
||||
expect(rendered).to match /Some prompt for teacher data/
|
||||
expect(rendered).to match /Some admin data item description/
|
||||
expect(rendered).to match(/Some prompt for student data/)
|
||||
expect(rendered).to match(/Some prompt for teacher data/)
|
||||
expect(rendered).to match(/Some admin data item description/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,8 +5,9 @@ describe 'overview/index' do
|
|||
|
||||
let(:support_for_teaching) do
|
||||
measure = create(:measure, name: 'Support For Teaching Development & Growth', measure_id: '1')
|
||||
scale = create(:scale, measure:)
|
||||
create(:student_survey_item,
|
||||
measure: measure,
|
||||
scale:,
|
||||
watch_low_benchmark: 1.5,
|
||||
growth_low_benchmark: 2.5,
|
||||
approval_low_benchmark: 3.5,
|
||||
|
|
@ -16,8 +17,9 @@ describe 'overview/index' do
|
|||
|
||||
let(:effective_leadership) do
|
||||
measure = create(:measure, name: 'Effective Leadership', measure_id: '2')
|
||||
scale = create(:scale, measure:)
|
||||
create(:teacher_survey_item,
|
||||
measure: measure,
|
||||
scale:,
|
||||
watch_low_benchmark: 1.5,
|
||||
growth_low_benchmark: 2.5,
|
||||
approval_low_benchmark: 3.5,
|
||||
|
|
@ -27,8 +29,9 @@ describe 'overview/index' do
|
|||
|
||||
let(:professional_qualifications) do
|
||||
measure = create(:measure, name: 'Professional Qualifications', measure_id: '3')
|
||||
scale = create(:scale, measure:)
|
||||
create(:admin_data_item,
|
||||
measure: measure,
|
||||
scale:,
|
||||
watch_low_benchmark: 1.5,
|
||||
growth_low_benchmark: 2.5,
|
||||
approval_low_benchmark: 3.5,
|
||||
|
|
@ -71,14 +74,15 @@ describe 'overview/index' do
|
|||
context 'when all the presenters have a non-nil score' do
|
||||
let(:variance_chart_row_presenters) do
|
||||
measure = create(:measure, name: 'Display Me', measure_id: 'display-me')
|
||||
scale = create(:scale, measure:)
|
||||
create(:student_survey_item,
|
||||
measure: measure,
|
||||
scale:,
|
||||
watch_low_benchmark: 1.5,
|
||||
growth_low_benchmark: 2.5,
|
||||
approval_low_benchmark: 3.5,
|
||||
ideal_low_benchmark: 4.5)
|
||||
[
|
||||
VarianceChartRowPresenter.new(measure: measure,
|
||||
VarianceChartRowPresenter.new(measure:,
|
||||
score: Score.new(rand))
|
||||
]
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,8 +6,17 @@ describe 'overview/_variance_chart.html.erb' do
|
|||
|
||||
let(:survey_items1) { [create(:student_survey_item)] }
|
||||
let(:survey_items2) { [create(:student_survey_item)] }
|
||||
let(:higher_scoring_measure) { create(:measure, survey_items: survey_items1) }
|
||||
let(:lower_scoring_measure) { create(:measure, survey_items: survey_items2) }
|
||||
let(:higher_scoring_measure) do
|
||||
measure = create(:measure)
|
||||
create(:scale, measure:, survey_items: survey_items1)
|
||||
measure
|
||||
end
|
||||
|
||||
let(:lower_scoring_measure) do
|
||||
measure = create(:measure)
|
||||
create(:scale, measure:, survey_items: survey_items2)
|
||||
measure
|
||||
end
|
||||
|
||||
before :each do
|
||||
presenters = [
|
||||
|
|
@ -15,7 +24,7 @@ describe 'overview/_variance_chart.html.erb' do
|
|||
VarianceChartRowPresenter.new(measure: higher_scoring_measure, score: Score.new(5))
|
||||
]
|
||||
|
||||
render partial: 'variance_chart', locals: { presenters: presenters }
|
||||
render partial: 'variance_chart', locals: { presenters: }
|
||||
end
|
||||
|
||||
it 'displays higher scoring measures above lower scoring measures' do
|
||||
|
|
@ -41,7 +50,7 @@ describe 'overview/_variance_chart.html.erb' do
|
|||
VarianceChartRowPresenter.new(measure: another_measure_lacking_score, score: Score.new(nil))
|
||||
]
|
||||
|
||||
render partial: 'variance_chart', locals: { presenters: presenters }
|
||||
render partial: 'variance_chart', locals: { presenters: }
|
||||
end
|
||||
|
||||
it "displays the text 'insufficient data' for an empty dataset" do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue