summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/project.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 9868e0444..c9d47b21b 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -425,9 +425,9 @@ class Project < ActiveRecord::Base
def rolled_up_trackers
@rolled_up_trackers ||=
Tracker.
- joins(:projects).
- joins("JOIN #{EnabledModule.table_name} ON #{EnabledModule.table_name}.project_id = #{Project.table_name}.id AND #{EnabledModule.table_name}.name = 'issue_tracking'").
+ joins(projects: :enabled_modules).
where("#{Project.table_name}.lft >= ? AND #{Project.table_name}.rgt <= ? AND #{Project.table_name}.status <> ?", lft, rgt, STATUS_ARCHIVED).
+ where("#{EnabledModule.table_name}.name = ?", 'issue_tracking').
uniq.
sorted.
to_a