mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-13 19:04:22 +01:00
get context, dependencies and admin scenarios running
This commit is contained in:
parent
7bce774daa
commit
d7aebf03a0
16 changed files with 49 additions and 40 deletions
|
|
@ -43,13 +43,13 @@ class Todo < ActiveRecord::Base
|
|||
|
||||
# other scopes
|
||||
scope :are_due, :conditions => ['NOT (todos.due IS NULL)']
|
||||
scope :with_tag, lambda { |tag_id| {:joins => :taggings, :conditions => ["taggings.tag_id = ? ", tag_id] } }
|
||||
scope :with_tags, lambda { |tag_ids| {:conditions => ["EXISTS(SELECT * from taggings t WHERE t.tag_id IN (?) AND t.taggable_id=todos.id AND t.taggable_type='Todo')", tag_ids] } }
|
||||
scope :of_user, lambda { |user_id| {:conditions => ["todos.user_id = ? ", user_id] } }
|
||||
scope :completed_after, lambda { |date| {:conditions => ["todos.completed_at > ?", date] } }
|
||||
scope :completed_before, lambda { |date| {:conditions => ["todos.completed_at < ?", date] } }
|
||||
scope :created_after, lambda { |date| {:conditions => ["todos.created_at > ?", date] } }
|
||||
scope :created_before, lambda { |date| {:conditions => ["todos.created_at < ?", date] } }
|
||||
scope :with_tag, lambda { |tag_id| joins("INNER JOIN taggings ON todos.id = taggings.taggable_id").where("taggings.tag_id = ? ", tag_id) }
|
||||
scope :with_tags, lambda { |tag_ids| where("EXISTS(SELECT * from taggings t WHERE t.tag_id IN (?) AND t.taggable_id=todos.id AND t.taggable_type='Todo')", tag_ids) }
|
||||
# scope :of_user, lambda { |user_id| {:conditions => ["todos.user_id = ? ", user_id] } }
|
||||
# scope :completed_after, lambda { |date| {:conditions => ["todos.completed_at > ?", date] } }
|
||||
# scope :completed_before, lambda { |date| {:conditions => ["todos.completed_at < ?", date] } }
|
||||
# scope :created_after, lambda { |date| {:conditions => ["todos.created_at > ?", date] } }
|
||||
# scope :created_before, lambda { |date| {:conditions => ["todos.created_at < ?", date] } }
|
||||
|
||||
STARRED_TAG_NAME = "starred"
|
||||
DEFAULT_INCLUDES = [ :project, :context, :tags, :taggings, :pending_successors, :uncompleted_predecessors, :recurring_todo ]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue