mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 23:30:12 +01:00
get the done view on a context and a project
This commit is contained in:
parent
35fe362b93
commit
a58e832945
10 changed files with 96 additions and 14 deletions
|
|
@ -224,6 +224,24 @@ class ApplicationController < ActionController::Base
|
|||
def prefered_auth?
|
||||
self.class.prefered_auth?
|
||||
end
|
||||
|
||||
def get_done_today(completed_todos, includes = {:include => Todo::DEFAULT_INCLUDES})
|
||||
start_of_this_day = Time.zone.now.beginning_of_day
|
||||
completed_todos.completed_after(start_of_this_day).all(includes)
|
||||
end
|
||||
|
||||
def get_done_this_week(completed_todos, includes = {:include => Todo::DEFAULT_INCLUDES})
|
||||
start_of_this_week = Time.zone.now.beginning_of_week
|
||||
start_of_this_day = Time.zone.now.beginning_of_day
|
||||
completed_todos.completed_after(start_of_this_week).completed_before(start_of_this_day).all(includes)
|
||||
end
|
||||
|
||||
def get_done_this_month(completed_todos, includes = {:include => Todo::DEFAULT_INCLUDES})
|
||||
start_of_this_month = Time.zone.now.beginning_of_month
|
||||
start_of_this_week = Time.zone.now.beginning_of_week
|
||||
completed_todos.completed_after(start_of_this_month).completed_before(start_of_this_week).all(includes)
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue