summaryrefslogtreecommitdiffstats
path: root/app/models/issue.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-12-26 12:07:07 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-12-26 12:07:07 +0000
commitb20598d755c511a9113d7554d5bda790fa64ea8a (patch)
tree43e9aebb8bdd8372f1253d043477b7b7f28ea519 /app/models/issue.rb
parentf8cb06bff2e50cbadd83e0ca4e7b4b892ccc0edf (diff)
downloadredmine-b20598d755c511a9113d7554d5bda790fa64ea8a.tar.gz
redmine-b20598d755c511a9113d7554d5bda790fa64ea8a.zip
Use :joins instead of :include in calculations.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8382 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r--app/models/issue.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index c46d035eb..4c7323c6d 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -817,7 +817,7 @@ class Issue < ActiveRecord::Base
def recalculate_attributes_for(issue_id)
if issue_id && p = Issue.find_by_id(issue_id)
# priority = highest priority of children
- if priority_position = p.children.maximum("#{IssuePriority.table_name}.position", :include => :priority)
+ if priority_position = p.children.maximum("#{IssuePriority.table_name}.position", :joins => :priority)
p.priority = IssuePriority.find_by_position(priority_position)
end
@@ -836,7 +836,7 @@ class Issue < ActiveRecord::Base
if average == 0
average = 1
end
- done = p.leaves.sum("COALESCE(estimated_hours, #{average}) * (CASE WHEN is_closed = #{connection.quoted_true} THEN 100 ELSE COALESCE(done_ratio, 0) END)", :include => :status).to_f
+ done = p.leaves.sum("COALESCE(estimated_hours, #{average}) * (CASE WHEN is_closed = #{connection.quoted_true} THEN 100 ELSE COALESCE(done_ratio, 0) END)", :joins => :status).to_f
progress = done / (average * leaves_count)
p.done_ratio = progress.round
end