Defect #33576 » fix-33576.patch
app/models/issue.rb | ||
---|---|---|
1741 | 1741 |
ratio = c.closed? ? 100 : (c.done_ratio || 0) |
1742 | 1742 |
estimated * ratio |
1743 | 1743 |
}.sum |
1744 |
progress = done / (average * children.count)
|
|
1744 |
progress = done.to_d / (average * children.count).to_d
|
|
1745 | 1745 |
p.done_ratio = progress.floor |
1746 | 1746 |
end |
1747 | 1747 |
end |
test/unit/issue_subtasking_test.rb | ||
---|---|---|
217 | 217 |
end |
218 | 218 |
end |
219 | 219 | |
220 |
def test_parent_done_ratio_with_completed_children_should_not_be_99 |
|
221 |
with_settings :parent_issue_done_ratio => 'derived' do |
|
222 |
parent = Issue.generate! |
|
223 |
parent.generate_child!(:estimated_hours => 8.0, :done_ratio => 100) |
|
224 |
parent.generate_child!(:estimated_hours => 8.1, :done_ratio => 100) |
|
225 |
# (8.0 * 100 + 8.1 * 100) / (8.0 + 8.1) => 99.99999999999999 |
|
226 |
assert_equal 100, parent.reload.done_ratio |
|
227 |
end |
|
228 |
end |
|
229 | ||
220 | 230 |
def test_done_ratio_of_parent_with_a_child_without_estimated_time_should_not_exceed_100 |
221 | 231 |
with_settings :parent_issue_done_ratio => 'derived' do |
222 | 232 |
parent = Issue.generate! |