summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-12-18 08:21:29 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-12-18 08:21:29 +0000
commit3717ff34afda47c02d5a6cc07bb14d049ebe18c6 (patch)
tree3e6579d49eb1c53debce90125f235b723e0105ed
parent2cf2f4964c103c24a219391831e6add6188e498b (diff)
downloadredmine-3717ff34afda47c02d5a6cc07bb14d049ebe18c6.tar.gz
redmine-3717ff34afda47c02d5a6cc07bb14d049ebe18c6.zip
Rails3.1 compatibility
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8275 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/issue.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 9b6be7db6..be69d929f 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -522,7 +522,8 @@ class Issue < ActiveRecord::Base
# spent_hours => 0.0
# spent_hours => 50.2
def total_spent_hours
- @total_spent_hours ||= self_and_descendants.sum("#{TimeEntry.table_name}.hours", :include => :time_entries).to_f || 0.0
+ @total_spent_hours ||= self_and_descendants.sum("#{TimeEntry.table_name}.hours",
+ :joins => "LEFT JOIN #{TimeEntry.table_name} ON #{TimeEntry.table_name}.issue_id = #{Issue.table_name}.id").to_f || 0.0
end
def relations