diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2014-02-14 02:33:00 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2014-02-14 02:33:00 +0000 |
commit | 0aaf7f799aba40ef7edb3252fc5fbc398d54daf7 (patch) | |
tree | cc1f681fb8f4483ba6349952728d5cd2468159e1 /lib | |
parent | 3d79ddfe753782c69df36cddbe19f743e04f2daa (diff) | |
download | redmine-0aaf7f799aba40ef7edb3252fc5fbc398d54daf7.tar.gz redmine-0aaf7f799aba40ef7edb3252fc5fbc398d54daf7.zip |
Rails4: replace deprecated Relation#sum with finder options at lib/redmine/helpers/time_report.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@12881 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r-- | lib/redmine/helpers/time_report.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/redmine/helpers/time_report.rb b/lib/redmine/helpers/time_report.rb index 2c71f098b..14a09694e 100644 --- a/lib/redmine/helpers/time_report.rb +++ b/lib/redmine/helpers/time_report.rb @@ -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] |