Refactor graphs to take new slice format Add Students and Teachers and Parents graph. Add selector for that graphrpp-main
parent
774f627661
commit
6269414bca
@ -0,0 +1,32 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Analyze
|
||||||
|
module Graph
|
||||||
|
class StudentsAndTeachersAndParents
|
||||||
|
include Analyze::Graph::Column
|
||||||
|
def to_s
|
||||||
|
"Students & Teachers & Parents"
|
||||||
|
end
|
||||||
|
|
||||||
|
def slug
|
||||||
|
"students-and-teachers-and-parents"
|
||||||
|
end
|
||||||
|
|
||||||
|
def columns
|
||||||
|
[AllStudent.new, AllTeacher.new, AllSurveyData.new]
|
||||||
|
end
|
||||||
|
|
||||||
|
def source
|
||||||
|
Analyze::Source::SurveyData.new(slices: [slice], graph: self)
|
||||||
|
end
|
||||||
|
|
||||||
|
def slice
|
||||||
|
Analyze::Slice::StudentsAndTeachersAndParents.new(graph: self)
|
||||||
|
end
|
||||||
|
|
||||||
|
def group
|
||||||
|
Analyze::Group::Base.new(name: nil, slug: nil, graph: nil)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Analyze
|
||||||
|
module Group
|
||||||
|
class Base
|
||||||
|
attr_reader :name, :slug, :graph
|
||||||
|
|
||||||
|
def initialize(name:, slug:, graph:)
|
||||||
|
@name = name
|
||||||
|
@slug = slug
|
||||||
|
@graph = graph
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -1,17 +0,0 @@
|
|||||||
module Analyze
|
|
||||||
module Group
|
|
||||||
class Ell
|
|
||||||
def name
|
|
||||||
"ELL"
|
|
||||||
end
|
|
||||||
|
|
||||||
def slug
|
|
||||||
"ell"
|
|
||||||
end
|
|
||||||
|
|
||||||
def graph
|
|
||||||
Analyze::Graph::StudentsByEll.new(ells: nil)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
module Analyze
|
|
||||||
module Group
|
|
||||||
class Gender
|
|
||||||
def name
|
|
||||||
"Gender"
|
|
||||||
end
|
|
||||||
|
|
||||||
def slug
|
|
||||||
"gender"
|
|
||||||
end
|
|
||||||
|
|
||||||
def graph
|
|
||||||
Analyze::Graph::StudentsByGender.new(genders: nil)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
module Analyze
|
|
||||||
module Group
|
|
||||||
class Grade
|
|
||||||
def name
|
|
||||||
"Grade"
|
|
||||||
end
|
|
||||||
|
|
||||||
def slug
|
|
||||||
"grade"
|
|
||||||
end
|
|
||||||
|
|
||||||
def graph
|
|
||||||
Analyze::Graph::StudentsByGrade.new(grades: nil)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
module Analyze
|
|
||||||
module Group
|
|
||||||
class Income
|
|
||||||
def name
|
|
||||||
"Income"
|
|
||||||
end
|
|
||||||
|
|
||||||
def slug
|
|
||||||
"income"
|
|
||||||
end
|
|
||||||
|
|
||||||
def graph
|
|
||||||
Analyze::Graph::StudentsByIncome.new(incomes: nil)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
module Analyze
|
|
||||||
module Group
|
|
||||||
class Race
|
|
||||||
def name
|
|
||||||
"Race"
|
|
||||||
end
|
|
||||||
|
|
||||||
def slug
|
|
||||||
"race"
|
|
||||||
end
|
|
||||||
|
|
||||||
def graph
|
|
||||||
Analyze::Graph::StudentsByRace.new(races: nil)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
module Analyze
|
||||||
|
module Slice
|
||||||
|
class Base
|
||||||
|
attr_reader :graph, :label, :slug
|
||||||
|
|
||||||
|
def initialize(label:, slug:, graph:)
|
||||||
|
@label = label
|
||||||
|
@slug = slug
|
||||||
|
@graph = graph
|
||||||
|
end
|
||||||
|
|
||||||
|
def to_s
|
||||||
|
label
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
module Analyze
|
||||||
|
module Slice
|
||||||
|
class StudentsAndTeachersAndParents < Base
|
||||||
|
def initialize(graph:, label: "Students & Teachers & Parents", slug: "students-and-teachers-and-pareents")
|
||||||
|
super(label:, slug:, graph:)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Reference in new issue