mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-17 07:40:12 +01:00
Remove the query code from TodosController
It has been completely replaced with our new query object
This commit is contained in:
parent
63ac90ebb2
commit
d08608c755
1 changed files with 1 additions and 33 deletions
|
|
@ -1316,39 +1316,7 @@ end
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_not_done_todos
|
def get_not_done_todos
|
||||||
if params[:done]
|
Todos::UndoneTodosQuery.new(current_user).query(params)
|
||||||
not_done_todos = current_user.todos.completed.completed_after(Time.zone.now - params[:done].to_i.days)
|
|
||||||
else
|
|
||||||
not_done_todos = current_user.todos.active.not_hidden
|
|
||||||
end
|
|
||||||
|
|
||||||
not_done_todos = not_done_todos.
|
|
||||||
reorder(Arel.sql("todos.due IS NULL, todos.due ASC, todos.created_at ASC")).
|
|
||||||
includes(Todo::DEFAULT_INCLUDES)
|
|
||||||
|
|
||||||
not_done_todos = not_done_todos.limit(sanitize(params[:limit])) if params[:limit]
|
|
||||||
|
|
||||||
if params[:due]
|
|
||||||
due_within_when = Time.zone.now + params['due'].to_i.days
|
|
||||||
not_done_todos = not_done_todos.where('todos.due <= ?', due_within_when)
|
|
||||||
end
|
|
||||||
|
|
||||||
if params[:tag]
|
|
||||||
tag = Tag.where(:name => params['tag']).first
|
|
||||||
not_done_todos = not_done_todos.where('taggings.tag_id = ?', tag.id)
|
|
||||||
end
|
|
||||||
|
|
||||||
if params[:context_id]
|
|
||||||
context = current_user.contexts.find(params[:context_id])
|
|
||||||
not_done_todos = not_done_todos.where('context_id' => context.id)
|
|
||||||
end
|
|
||||||
|
|
||||||
if params[:project_id]
|
|
||||||
project = current_user.projects.find(params[:project_id])
|
|
||||||
not_done_todos = not_done_todos.where('project_id' => project)
|
|
||||||
end
|
|
||||||
|
|
||||||
return Todos::UndoneTodosQuery.new(current_user).query(params)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def onsite_redirect_to(destination)
|
def onsite_redirect_to(destination)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue