##// END OF EJS Templates
Replaces find(:all) calls....
Jean-Philippe Lang -
r10694:45ea24ecad0e
parent child
Show More
@@ -406,10 +406,12 class Project < ActiveRecord::Base
406 # Returns an array of the trackers used by the project and its active sub projects
406 # Returns an array of the trackers used by the project and its active sub projects
407 def rolled_up_trackers
407 def rolled_up_trackers
408 @rolled_up_trackers ||=
408 @rolled_up_trackers ||=
409 Tracker.find(:all, :joins => :projects,
409 Tracker.
410 :select => "DISTINCT #{Tracker.table_name}.*",
410 joins(:projects).
411 :conditions => ["#{Project.table_name}.lft >= ? AND #{Project.table_name}.rgt <= ? AND #{Project.table_name}.status <> #{STATUS_ARCHIVED}", lft, rgt],
411 select("DISTINCT #{Tracker.table_name}.*").
412 :order => "#{Tracker.table_name}.position")
412 where("#{Project.table_name}.lft >= ? AND #{Project.table_name}.rgt <= ? AND #{Project.table_name}.status <> #{STATUS_ARCHIVED}", lft, rgt).
413 sorted.
414 all
413 end
415 end
414
416
415 # Closes open and locked project versions that are completed
417 # Closes open and locked project versions that are completed
General Comments 0
You need to be logged in to leave comments. Login now