1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-10-17 17:01:01 +00:00

The progress exceeding 99.5% is displayed as 100% (#27848).

Patch by Mizuki ISHIKAWA.

git-svn-id: http://svn.redmine.org/redmine/trunk@17169 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2018-01-08 22:35:59 +00:00
parent 054f3bb424
commit 6d4c0a77fe
2 changed files with 12 additions and 1 deletions

View File

@ -1704,7 +1704,7 @@ class Issue < ActiveRecord::Base
estimated * ratio
}.sum
progress = done / (average * children.count)
p.done_ratio = progress.round
p.done_ratio = progress.floor
end
end
end

View File

@ -157,6 +157,17 @@ class IssueSubtaskingTest < ActiveSupport::TestCase
end
end
def test_parent_done_ratio_should_be_rounded_down_to_the_nearest_integer
with_settings :parent_issue_done_ratio => 'derived' do
parent = Issue.generate!
parent.generate_child!(:done_ratio => 20)
parent.generate_child!(:done_ratio => 20)
parent.generate_child!(:done_ratio => 10)
# (20 + 20 + 10) / 3 = 16.666...
assert_equal 16, parent.reload.done_ratio
end
end
def test_parent_done_ratio_should_be_weighted_by_estimated_times_if_any
with_settings :parent_issue_done_ratio => 'derived' do
parent = Issue.generate!