Class: Trollo::Task

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Troller, Workflow
Defined in:
lib/trollo/task.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Troller

included

Class Method Details

.overdueObject



19
20
21
# File 'lib/trollo/task.rb', line 19

def self.overdue
  with_incomplete_state.where('due_at IS NOT NULL AND due_at < ?', Time.now)
end

.search(term) ⇒ Object



13
14
15
16
17
# File 'lib/trollo/task.rb', line 13

def self.search(term)
  unless term.blank?
    where("name LIKE :q", q: "%#{term}%")
  end
end

Instance Method Details

#overdue?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/trollo/task.rb', line 37

def overdue?
  incomplete? && due_at && (Time.now > due_at)
end

#set_ordinalObject



33
34
35
# File 'lib/trollo/task.rb', line 33

def set_ordinal
  self.ordinal ||= tasklist.tasks.length + 1
end

#update_tasklistObject



41
42
43
# File 'lib/trollo/task.rb', line 41

def update_tasklist
  tasklist.check
end