Patch #44736 ยป 0001-Use-Enumerable-sum-instead-of-inject-and-explicit-lo.patch
| app/helpers/timelog_helper.rb | ||
|---|---|---|
| 65 | 65 |
end |
| 66 | 66 | |
| 67 | 67 |
def sum_hours(data) |
| 68 |
sum = 0 |
|
| 69 |
data.each do |row| |
|
| 70 |
sum += row['hours'].to_f |
|
| 71 |
end |
|
| 72 |
sum |
|
| 68 |
data.sum {|row| row['hours'].to_f}
|
|
| 73 | 69 |
end |
| 74 | 70 | |
| 75 | 71 |
def format_criteria_value(criteria_options, value, html=true) |
| lib/redmine/helpers/gantt.rb | ||
|---|---|---|
| 122 | 122 |
def number_of_rows |
| 123 | 123 |
return @number_of_rows if @number_of_rows |
| 124 | 124 | |
| 125 |
rows = projects.inject(0) {|total, p| total += number_of_rows_on_project(p)}
|
|
| 125 |
rows = projects.sum {|p| number_of_rows_on_project(p)}
|
|
| 126 | 126 |
[rows, @max_rows].min |
| 127 | 127 |
end |
| 128 | 128 | |
| lib/redmine/helpers/time_report.rb | ||
|---|---|---|
| 77 | 77 |
max = @hours.pluck('spent_on').max
|
| 78 | 78 |
@to = max ? max.to_date : User.current.today |
| 79 | 79 | |
| 80 |
@total_hours = @hours.inject(0) {|s, k| s = s + k['hours'].to_f}
|
|
| 80 |
@total_hours = @hours.sum {|k| k['hours'].to_f}
|
|
| 81 | 81 | |
| 82 | 82 |
@periods = [] |
| 83 | 83 |
# Date#at_beginning_of_ not supported in Rails 1.2.x |