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.
sqm-dashboards/app/models/education.rb

46 lines
1.2 KiB

class Education < ApplicationRecord
scope :by_designation, -> { all.map { |education| [education.designation, education] }.to_h }
def self.to_designation(education)
return "Unknown" if education.blank? || education.nil?
case education
in /^1$/i
"No formal schooling completed"
in /^2$/i
"Some formal schooling"
in /^3$/i
"High school diploma or GED"
in /^4$/i
"Associates Degree"
in /^5$/i
"Bachelors Degree"
in /^6$/i
"Masters Degree"
in /^7$/i
"Professional Degree"
in /^8$/i
"Doctorate Degree"
in /^99$|^100$/i
"Unknown"
else
puts "************************************"
puts "******** ERROR **********"
puts ""
puts "Error parsing Education column. '#{education}' is not a known value. Halting execution"
puts ""
puts "************************************"
exit
end
end
def points
higher_level_education = ["Associates Degree", "Bachelors Degree", "Masters Degree", "Professional Degree", "Doctorate Degree"]
if higher_level_education.include?(designation)
1
else
0
end
end
end