mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-24 03:00:12 +01:00
Merge pull request #63 from Popsch/opt_limits
don't execute a query when limit == 0
This commit is contained in:
commit
dc0a141f1c
1 changed files with 5 additions and 1 deletions
|
|
@ -94,8 +94,12 @@ class ProjectsController < ApplicationController
|
|||
@not_done = @project.todos.active_or_hidden(:include => Todo::DEFAULT_INCLUDES)
|
||||
@deferred = @project.todos.deferred(:include => Todo::DEFAULT_INCLUDES)
|
||||
@pending = @project.todos.pending(:include => Todo::DEFAULT_INCLUDES)
|
||||
|
||||
@done = {}
|
||||
@done = @project.todos.find_in_state(:all, :completed,
|
||||
:order => "todos.completed_at DESC", :limit => current_user.prefs.show_number_completed, :include => Todo::DEFAULT_INCLUDES)
|
||||
:order => "todos.completed_at DESC",
|
||||
:limit => current_user.prefs.show_number_completed,
|
||||
:include => Todo::DEFAULT_INCLUDES) unless current_user.prefs.show_number_completed == 0
|
||||
|
||||
@count = @not_done.size
|
||||
@down_count = @count + @deferred.size + @pending.size
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue