mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-03 06:21:49 +01:00
A slight modification to my last refactor: using singleton methods instead of a mix-in.
git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@304 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
c290d7a36a
commit
9158c4341c
1 changed files with 11 additions and 13 deletions
|
|
@ -21,19 +21,17 @@ class Todo < ActiveRecord::Base
|
|||
:conditions => ['todos.user_id = ? and todos.done = ? and todos.completed is not null', user_id, true],
|
||||
:order => 'todos.completed DESC',
|
||||
:include => [ :project, :context ])
|
||||
done.extend(CompletedToDosByDate)
|
||||
|
||||
def done.completed_within( date )
|
||||
reject { |x| x.completed < date }
|
||||
end
|
||||
|
||||
def done.completed_more_than( date )
|
||||
reject { |x| x.completed > date }
|
||||
end
|
||||
|
||||
done
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
module CompletedToDosByDate
|
||||
|
||||
def completed_within( date )
|
||||
self.reject { |x| x.completed < date }
|
||||
end
|
||||
|
||||
def completed_more_than( date )
|
||||
self.reject { |x| x.completed > date }
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue