mirror of
https://github.com/TracksApp/tracks.git
synced 2026-04-18 01:59:02 +02:00
fix #857 and further refactoring for better done view
This commit is contained in:
parent
c61238933c
commit
35fe362b93
10 changed files with 76 additions and 30 deletions
|
|
@ -44,6 +44,7 @@ class Todo < ActiveRecord::Base
|
|||
named_scope :completed_before, lambda { |date| {:conditions => ["todos.completed_at < ? ", date] } }
|
||||
|
||||
STARRED_TAG_NAME = "starred"
|
||||
DEFAULT_INCLUDES = [ :project, :context, :tags, :taggings, :pending_successors, :successors, :predecessors, :recurring_todo ]
|
||||
|
||||
# regular expressions for dependencies
|
||||
RE_TODO = /[^']+/
|
||||
|
|
@ -182,7 +183,17 @@ class Todo < ActiveRecord::Base
|
|||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def has_pending_successors
|
||||
# has_many :pending_successors, :through => :predecessor_dependencies,
|
||||
# :source => :successor, :conditions => ['todos.state = ?', 'pending']
|
||||
|
||||
successors = predecessor_dependencies.all(:include => [:successor])
|
||||
pending = successors.reject { |d| !( d.successor.state=='pending') }
|
||||
return !pending.empty?
|
||||
#return !pending_successors.empty?
|
||||
end
|
||||
|
||||
def has_tag?(tag)
|
||||
return self.tags.select{|t| t.name==tag }.size > 0
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue