Project

General

Profile

Defect #27848 » Change_the_progress_rate_to_round_down.patch

Mizuki ISHIKAWA, 2017-12-25 07:53

View differences:

app/models/issue.rb
estimated * ratio
}.sum
progress = done / (average * children.count)
p.done_ratio = progress.round
p.done_ratio = progress.floor
end
end
end
test/unit/issue_subtasking_test.rb
end
end
def test_parent_done_ratio_should_round_down_to_the_nearest_decimal
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!
(2-2/3)