mirror of
https://github.com/edcommonwealth/Dashboard.git
synced 2026-03-18 10:16:25 -07:00
dirty commit: can't get references to work correctly between any tables
This commit is contained in:
parent
e1f0b78236
commit
a4fddbeced
183 changed files with 5461 additions and 5 deletions
47
app/presenters/dashboard/analyze/graph/students_by_race.rb
Normal file
47
app/presenters/dashboard/analyze/graph/students_by_race.rb
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Analyze
|
||||
module Graph
|
||||
class StudentsByRace
|
||||
attr_reader :races
|
||||
|
||||
def initialize(races:)
|
||||
@races = races
|
||||
end
|
||||
|
||||
def to_s
|
||||
"Students by Race"
|
||||
end
|
||||
|
||||
def slug
|
||||
"students-by-race"
|
||||
end
|
||||
|
||||
def columns
|
||||
[].tap do |array|
|
||||
races.each do |race|
|
||||
array << column_for_race_code(code: race.qualtrics_code)
|
||||
end
|
||||
array << Analyze::Graph::Column::AllStudent
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def column_for_race_code(code:)
|
||||
CFR[code.to_s]
|
||||
end
|
||||
|
||||
CFR = {
|
||||
"1" => Analyze::Graph::Column::RaceColumn::AmericanIndian,
|
||||
"2" => Analyze::Graph::Column::RaceColumn::Asian,
|
||||
"3" => Analyze::Graph::Column::RaceColumn::Black,
|
||||
"4" => Analyze::Graph::Column::RaceColumn::Hispanic,
|
||||
"5" => Analyze::Graph::Column::RaceColumn::White,
|
||||
"8" => Analyze::Graph::Column::RaceColumn::MiddleEastern,
|
||||
"99" => Analyze::Graph::Column::RaceColumn::Unknown,
|
||||
"100" => Analyze::Graph::Column::RaceColumn::Multiracial
|
||||
}.freeze
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue