You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
927 B
43 lines
927 B
module Analyze
|
|
module Graph
|
|
class StudentsByGender
|
|
include Analyze::Graph::Column::GenderColumn
|
|
attr_reader :genders
|
|
|
|
def initialize(genders:)
|
|
@genders = genders
|
|
end
|
|
|
|
def to_s
|
|
'Students by Gender'
|
|
end
|
|
|
|
def slug
|
|
'students-by-gender'
|
|
end
|
|
|
|
def columns
|
|
[].tap do |array|
|
|
genders.each do |gender|
|
|
array << column_for_gender_code(code: gender.qualtrics_code)
|
|
end
|
|
array << Analyze::Graph::Column::AllStudent
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def column_for_gender_code(code:)
|
|
CFR[code]
|
|
end
|
|
|
|
CFR = {
|
|
1 => Analyze::Graph::Column::GenderColumn::Female,
|
|
2 => Analyze::Graph::Column::GenderColumn::Male,
|
|
4 => Analyze::Graph::Column::GenderColumn::NonBinary,
|
|
99 => Analyze::Graph::Column::GenderColumn::Unknown
|
|
}.freeze
|
|
end
|
|
end
|
|
end
|