Patch #44736 ยป 0001-Use-Enumerable-sum-instead-of-inject-and-explicit-lo.patch
| app/helpers/timelog_helper.rb | ||
|---|---|---|
|
end
|
||
|
def sum_hours(data)
|
||
|
sum = 0
|
||
|
data.each do |row|
|
||
|
sum += row['hours'].to_f
|
||
|
end
|
||
|
sum
|
||
|
data.sum {|row| row['hours'].to_f}
|
||
|
end
|
||
|
def format_criteria_value(criteria_options, value, html=true)
|
||
| lib/redmine/helpers/gantt.rb | ||
|---|---|---|
|
def number_of_rows
|
||
|
return @number_of_rows if @number_of_rows
|
||
|
rows = projects.inject(0) {|total, p| total += number_of_rows_on_project(p)}
|
||
|
rows = projects.sum {|p| number_of_rows_on_project(p)}
|
||
|
[rows, @max_rows].min
|
||
|
end
|
||
| lib/redmine/helpers/time_report.rb | ||
|---|---|---|
|
max = @hours.pluck('spent_on').max
|
||
|
@to = max ? max.to_date : User.current.today
|
||
|
@total_hours = @hours.inject(0) {|s, k| s = s + k['hours'].to_f}
|
||
|
@total_hours = @hours.sum {|k| k['hours'].to_f}
|
||
|
@periods = []
|
||
|
# Date#at_beginning_of_ not supported in Rails 1.2.x
|
||