akam_roadmap/app/models/project.rb

39 lines
769 B
Ruby
Raw Normal View History

2014-11-06 21:50:01 +00:00
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
2014-11-07 20:56:49 +00:00
"<span class='checkmark'>&check;</span>".html_safe
2014-11-06 21:50:01 +00:00
elsif Date.today > due
2014-11-07 20:56:49 +00:00
"<span class='overdue'>Overdue</span>".html_safe
2014-11-06 21:50:01 +00:00
else
due
end
end
end