Added some database optimizations, mostly in the form of indices on commonly queried columns

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@396 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2007-01-11 05:29:29 +00:00
parent ead9a4cfe9
commit d8ec265ca4
6 changed files with 48 additions and 11 deletions

View file

@ -16,7 +16,6 @@ class ApplicationController < ActionController::Base
layout 'standard'
before_filter :set_session_expiration
before_filter :get_current_user
prepend_before_filter :login_required
after_filter :set_charset
@ -64,12 +63,7 @@ class ApplicationController < ActionController::Base
end
private
def get_current_user
@user = User.find(session['user_id']) if session['user_id']
@prefs = @user.prefs unless @user.nil?
end
def parse_date_per_user_prefs( s )
return nil if s.blank?
@user.prefs.tz.unadjust(Date.strptime(s, @user.prefs.date_format)).utc.to_date

View file

@ -155,7 +155,7 @@ class ContextController < ApplicationController
# 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_in_state(:all, :active, :order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC")
@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)
@count = @not_done_todos.size
end