Class: Trollo::Task
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Trollo::Task
- Includes:
- Troller, Workflow
- Defined in:
- lib/trollo/task.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Troller
Class Method Details
.overdue ⇒ Object
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
37 38 39 |
# File 'lib/trollo/task.rb', line 37 def overdue? incomplete? && due_at && (Time.now > due_at) end |
#set_ordinal ⇒ Object
33 34 35 |
# File 'lib/trollo/task.rb', line 33 def set_ordinal self.ordinal ||= tasklist.tasks.length + 1 end |
#update_tasklist ⇒ Object
41 42 43 |
# File 'lib/trollo/task.rb', line 41 def update_tasklist tasklist.check end |