summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2014-01-10 05:02:44 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2014-01-10 05:02:44 +0000
commit56a3c1ad40e7d4f2b7d65ce0ffe7110069cffd60 (patch)
treed888b27baea89622a305caee986fb0d7bf5f4d71 /app
parent5d535f899644a504401022c0c25dfc88c595deb3 (diff)
downloadredmine-56a3c1ad40e7d4f2b7d65ce0ffe7110069cffd60.tar.gz
redmine-56a3c1ad40e7d4f2b7d65ce0ffe7110069cffd60.zip
Rails4: replace deprecated Relation#sum with finder options at Issue#total_spent_hours
git-svn-id: http://svn.redmine.org/redmine/trunk@12588 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/models/issue.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index abf4cec92..6cfe97927 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -839,8 +839,10 @@ 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",
- :joins => "LEFT JOIN #{TimeEntry.table_name} ON #{TimeEntry.table_name}.issue_id = #{Issue.table_name}.id").to_f || 0.0
+ @total_spent_hours ||=
+ self_and_descendants.
+ joins("LEFT JOIN #{TimeEntry.table_name} ON #{TimeEntry.table_name}.issue_id = #{Issue.table_name}.id").
+ sum("#{TimeEntry.table_name}.hours").to_f || 0.0
end
def relations