Module: Flyboy::ApplicationHelper

Defined in:
app/helpers/flyboy/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#goal_color(goal) ⇒ Object



4
5
6
7
8
9
# File 'app/helpers/flyboy/application_helper.rb', line 4

def goal_color(goal)
  return "onalert"   if Flyboy::Task.where('goal_id = ? AND done = ? AND term < ?', goal.id, false, Date.today).count > 0
  return "onwarning" if Flyboy::Task.where('goal_id = ? AND done = ? AND term > ? AND reminder < ?', goal.id , false, Date.today, Date.today).count > 0
  return "finished"  if goal.closed?
  return "ontime"
end

#task_color(task) ⇒ Object



11
12
13
14
15
16
# File 'app/helpers/flyboy/application_helper.rb', line 11

def task_color(task)
  return "finished" if task.done
  return "ontime"   if task.reminder > Date.today
  return "onalert"  if task.term <  Date.today
  return "onwarning"
end