Defect #27848 » Change_the_progress_rate_to_round_down.patch
app/models/issue.rb | ||
---|---|---|
1704 | 1704 |
estimated * ratio |
1705 | 1705 |
}.sum |
1706 | 1706 |
progress = done / (average * children.count) |
1707 |
p.done_ratio = progress.round
|
|
1707 |
p.done_ratio = progress.floor
|
|
1708 | 1708 |
end |
1709 | 1709 |
end |
1710 | 1710 |
end |
test/unit/issue_subtasking_test.rb | ||
---|---|---|
157 | 157 |
end |
158 | 158 |
end |
159 | 159 | |
160 |
def test_parent_done_ratio_should_round_down_to_the_nearest_decimal |
|
161 |
with_settings :parent_issue_done_ratio => 'derived' do |
|
162 |
parent = Issue.generate! |
|
163 |
parent.generate_child!(:done_ratio => 20) |
|
164 |
parent.generate_child!(:done_ratio => 20) |
|
165 |
parent.generate_child!(:done_ratio => 10) |
|
166 |
# (20 + 20 + 10) / 3 = 16.666... |
|
167 |
assert_equal 16, parent.reload.done_ratio |
|
168 |
end |
|
169 |
end |
|
170 | ||
160 | 171 |
def test_parent_done_ratio_should_be_weighted_by_estimated_times_if_any |
161 | 172 |
with_settings :parent_issue_done_ratio => 'derived' do |
162 | 173 |
parent = Issue.generate! |