mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-17 06:35:28 +01:00
Optimized ActiveRecord calls to minimize SQL queries, especially on the home page. Also, moved feed page to feed controller.
git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@294 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
afaf2235fa
commit
e0e407d99a
30 changed files with 151 additions and 115 deletions
|
|
@ -27,6 +27,7 @@ class ContextController < ApplicationController
|
|||
#
|
||||
def show
|
||||
init
|
||||
check_user_set_context
|
||||
init_todos
|
||||
@on_page = "context"
|
||||
@page_title = "TRACKS::Context: #{@context.name}"
|
||||
|
|
@ -219,13 +220,14 @@ class ContextController < ApplicationController
|
|||
@contexts = @user.contexts
|
||||
@todos = @user.todos
|
||||
@done = Todo.find(:all, :conditions => ["todos.user_id = ? and todos.done = ?", @user.id, true], :include => [:project], :order => "completed DESC")
|
||||
init_not_done_counts
|
||||
end
|
||||
|
||||
def init_todos
|
||||
check_user_set_context
|
||||
@done = @context.done_todos
|
||||
@not_done = @context.not_done_todos
|
||||
@count = @not_done.size
|
||||
@not_done_todos = @context.not_done_todos
|
||||
@count = @not_done_todos.size
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue