summaryrefslogtreecommitdiffstats
path: root/app/models/issue.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2020-06-14 06:56:05 +0000
committerGo MAEDA <maeda@farend.jp>2020-06-14 06:56:05 +0000
commit6416bb5f5150f3b3077ae39e088f6b9fdf63f43a (patch)
treeb52e4ccfeed5d46f6898b23be2023984f3ea823d /app/models/issue.rb
parent6bad47168d869ad33942684b925b89188c417b49 (diff)
downloadredmine-6416bb5f5150f3b3077ae39e088f6b9fdf63f43a.tar.gz
redmine-6416bb5f5150f3b3077ae39e088f6b9fdf63f43a.zip
Done ratio of a parent issue may be shown as 99% even though all subtasks are completed (#33576).
Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@19818 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r--app/models/issue.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index e665a46cb..a89f23dd8 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -1731,12 +1731,12 @@ 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_f / child_with_total_estimated_hours.count
+ average = child_with_total_estimated_hours.map(&:total_estimated_hours).sum.to_d / child_with_total_estimated_hours.count
else
- average = 1.0
+ average = 1.0.to_d
end
done = children.map {|c|
- estimated = c.total_estimated_hours.to_f
+ 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