feat: ECP-126 Add measure and scale level graphs for parents by language

WIP: refactor so multiple graphs can be defined for a given slug

WIP: fixed scale view but broke 'All Parent' graph

WIP: working state.  All views working properly

WIP: Refactor graph_map into two collections; measure_level_graphs and scale_level_graphs

WIP: refacter GroupedBarColumnPresenter to accept a 'construct' instead of specifying measure or scale

WIP: fix scale graphs being shown on incorrect view

WIP: Merge parents_by_language class with parents_by_language_by_scale so it can handle display of both measure-level and scale-level graphs
This commit is contained in:
rebuilt 2025-05-06 14:14:47 -07:00
parent 7380d56064
commit 513445dc74
30 changed files with 333 additions and 249 deletions

View file

@ -15,7 +15,9 @@ describe Analyze::Presenter do
create(:wrong_measure, measure_id: "99A", name: "wrong measure", subcategory: wrong_subcategory)
end
let(:scale) { create(:student_scale, measure:) }
let(:parent_scale) { create(:parent_scale, measure:) }
let(:survey_item) { create(:student_survey_item, scale:) }
let(:parent_survey_item) { create(:parent_survey_item, scale: parent_scale) }
let(:school) { create(:school) }
let(:academic_year) { create(:academic_year) }
let(:ay_2021_22) { create(:academic_year, range: "2021-22") }
@ -426,6 +428,24 @@ describe Analyze::Presenter do
end
end
context "when the graph is 'parents-by-language'" do
before :each do
parent_survey_item
parent_scale
measure
end
it "returns the slice with the given slug" do
params = { graph: "parents-by-language" }
presenter = Analyze::Presenter.new(params:, school:, academic_year:)
expect(presenter.slice.slug).to eq "parents-by-group"
expect(presenter.requested_graphs).to eq "parents-by-language"
expect(presenter.show_secondary_graph?(measure:)).to eq false
expect(presenter.show_scale_level_graphs?(measure:)).to eq true
expect(presenter.secondary_graph.class.to_s).to eq "Analyze::Graph::AllParent"
expect(presenter.secondary_graph.slug).to eq "all-parent"
end
end
context "when the graph is of a disaggregation group" do
it "returns the slice with the given slug" do
params = { graph: "students-by-ell" }

View file

@ -63,17 +63,17 @@ describe GroupedBarColumnPresenter do
end
let(:student_presenter) do
GroupedBarColumnPresenter.new measure: measure_with_student_survey_items, school:, academic_years:,
GroupedBarColumnPresenter.new construct: measure_with_student_survey_items, school:, academic_years:,
position: 0, number_of_columns: 3, config: Analyze::Graph::Column::AllStudent.new
end
let(:teacher_presenter) do
GroupedBarColumnPresenter.new measure: measure_with_teacher_survey_items, school:, academic_years:,
GroupedBarColumnPresenter.new construct: measure_with_teacher_survey_items, school:, academic_years:,
position: 0, number_of_columns: 3, config: Analyze::Graph::Column::AllTeacher.new
end
let(:all_data_presenter) do
GroupedBarColumnPresenter.new measure: measure_composed_of_student_and_teacher_items, school:, academic_years:,
GroupedBarColumnPresenter.new construct: measure_composed_of_student_and_teacher_items, school:, academic_years:,
position: 0, number_of_columns: 3, config: Analyze::Graph::Column::AllData.new
end
@ -83,7 +83,7 @@ describe GroupedBarColumnPresenter do
shared_examples_for "measure_name" do
it "returns the measure name" do
expect(student_presenter.measure_name).to eq "Student measure"
expect(student_presenter.construct_name).to eq "Student measure"
end
end