Project

General

Profile

Patch #44736 ยป 0001-Use-Enumerable-sum-instead-of-inject-and-explicit-lo.patch

Go MAEDA, 2026-11-10 08:33

View differences:

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
    (1-1/1)