sqm-dashboards/app/presenters/analyze/graph/students_by_income.rb
rebuilt c70f051e1e Refactor groups
Refactor graphs to take new slice format

Add Students and Teachers and Parents graph.  Add selector for that
graph
2025-03-20 13:12:52 -07:00

42 lines
838 B
Ruby

# frozen_string_literal: true
module Analyze
module Graph
class StudentsByIncome
attr_reader :incomes
def initialize(incomes:)
@incomes = incomes
end
def to_s
"Students by income"
end
def slug
"students-by-income"
end
def columns
[].tap do |array|
incomes.each do |income|
array << Analyze::Graph::Column::Income.new(income:)
end
array << Analyze::Graph::Column::AllStudent.new
end
end
def source
Analyze::Source::SurveyData.new(slices: [slice], graph: self)
end
def slice
Analyze::Slice::StudentsByGroup.new(graph: self)
end
def group
Analyze::Group::Base.new(name: "Income", slug: "income", graph: self)
end
end
end
end