]> source.dussan.org Git - redmine.git/commitdiff
Rails4: replace deprecated Relation#sum with finder options at lib/redmine/helpers...
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Fri, 14 Feb 2014 02:33:00 +0000 (02:33 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Fri, 14 Feb 2014 02:33:00 +0000 (02:33 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@12881 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/helpers/time_report.rb

index 2c71f098b906a90d6b91bbb3704dedad136a5a68..14a09694e2426cd53ed75f03a8adddfc44639bd2 100644 (file)
@@ -45,10 +45,10 @@ module Redmine
         unless @criteria.empty?
           time_columns = %w(tyear tmonth tweek spent_on)
           @hours = []
-          @scope.sum(:hours,
-              :include => [:issue, :activity],
-              :group => @criteria.collect{|criteria| @available_criteria[criteria][:sql]} + time_columns,
-              :joins => @criteria.collect{|criteria| @available_criteria[criteria][:joins]}.compact).each do |hash, hours|
+          @scope.includes(:issue, :activity).
+              group(@criteria.collect{|criteria| @available_criteria[criteria][:sql]} + time_columns).
+              joins(@criteria.collect{|criteria| @available_criteria[criteria][:joins]}.compact).
+              sum(:hours).each do |hash, hours|
             h = {'hours' => hours}
             (@criteria + time_columns).each_with_index do |name, i|
               h[name] = hash[i]