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
This commit is contained in:
Toshi MARUYAMA 2014-02-14 02:33:00 +00:00
parent 3d79ddfe75
commit 0aaf7f799a
1 changed files with 4 additions and 4 deletions

View File

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