Fix issue where completed items would redundantly show context on a context page and project on a project page.

Eliminated some N+1 query generation issues on context and project detail pages related to looking up tags.
Added rake task to turn on and off the mysql query_analyzer plugin, which I'm using to help in my optimization process.



git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@662 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2007-11-27 05:51:38 +00:00
parent 1516d7ae14
commit 0f823a8a2e
9 changed files with 55 additions and 16 deletions

View file

@ -155,12 +155,14 @@ class ContextsController < ApplicationController
def init_todos
set_context_from_params
unless @context.nil?
@done = @context.done_todos
@context.todos.with_scope :find => { :include => [:project, :tags] } do
@done = @context.done_todos
end
# @not_done_todos = @context.not_done_todos
# TODO: Temporarily doing this search manually until I can work out a way
# to do the same thing using not_done_todos acts_as_todo_container method
# Hides actions in hidden projects from context.
@not_done_todos = @context.todos.find(:all, :conditions => ['todos.state = ?', 'active'], :order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC", :include => :project)
@not_done_todos = @context.todos.find(:all, :conditions => ['todos.state = ?', 'active'], :order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC", :include => [:project, :tags])
@count = @not_done_todos.size
@default_project_context_name_map = build_default_project_context_name_map(@projects).to_json
end