akam_roadmap/app/models/project.rb
2014-11-07 15:56:49 -05:00

39 lines
769 B
Ruby

class Project < ActiveRecord::Base
def self.status_keys
{upcoming: 0, active: 1, backlog: 2, completed: 3}
end
enum status: self.status_keys
def requirements
check_date_overdue_output requirements_completed?, requirements_due
end
def design
check_date_overdue_output design_completed?, design_due
end
def devops
check_date_overdue_output devops_completed?, devops_due
end
def qalaunch
check_date_overdue_output qalaunch_completed?, qalaunch_due
end
private
def check_date_overdue_output completed, due
if completed
"<span class='checkmark'>&check;</span>".html_safe
elsif Date.today > due
"<span class='overdue'>Overdue</span>".html_safe
else
due
end
end
end