Gantt perf: fixed that Project#start_date and #due_date run way too much queries.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11135 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2013-01-06 14:03:49 +00:00
parent 114537530f
commit 8ee0b52d59
3 changed files with 24 additions and 8 deletions
+4
View File
@@ -85,6 +85,10 @@ class Issue < ActiveRecord::Base
scope :on_active_project, lambda {
includes(:status, :project, :tracker).where("#{Project.table_name}.status = ?", Project::STATUS_ACTIVE)
}
scope :fixed_version, lambda {|versions|
ids = [versions].flatten.compact.map {|v| v.is_a?(Version) ? v.id : v}
ids.any? ? where(:fixed_version_id => ids) : where('1=0')
}
before_create :default_assign
before_save :close_duplicates, :update_done_ratio_from_issue_status, :force_updated_on_change