diff options
author | Go MAEDA <maeda@farend.jp> | 2020-12-06 01:36:39 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2020-12-06 01:36:39 +0000 |
commit | f43b3685ffb0f7e666e44e3338a8c13b689aa4e5 (patch) | |
tree | 3b122251bf719067bc4267226dd85500d45c8d3c /app/models/issue.rb | |
parent | 7467faf937c278e615b219a8f0cbce6a6fda838a (diff) | |
download | redmine-f43b3685ffb0f7e666e44e3338a8c13b689aa4e5.tar.gz redmine-f43b3685ffb0f7e666e44e3338a8c13b689aa4e5.zip |
Use sum { ... } instead of map { ... }.sum (#34399).
git-svn-id: http://svn.redmine.org/redmine/trunk@20581 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r-- | app/models/issue.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index bda93ddc8..6132f71e6 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -1743,16 +1743,16 @@ class Issue < ActiveRecord::Base if children.any? child_with_total_estimated_hours = children.select {|c| c.total_estimated_hours.to_f > 0.0} if child_with_total_estimated_hours.any? - average = child_with_total_estimated_hours.map(&:total_estimated_hours).sum.to_d / child_with_total_estimated_hours.count + average = child_with_total_estimated_hours.sum(&:total_estimated_hours).to_d / child_with_total_estimated_hours.count else average = 1.0.to_d end - done = children.map do |c| + done = children.sum do |c| estimated = (c.total_estimated_hours || 0.0).to_d estimated = average unless estimated > 0.0 ratio = c.closed? ? 100 : (c.done_ratio || 0) estimated * ratio - end.sum + end progress = done / (average * children.count) p.done_ratio = progress.floor end |