Defect #37151 » 37151-v2.patch
| app/models/issue.rb | ||
|---|---|---|
|
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.sum(&:total_estimated_hours).to_d /
|
||
|
child_with_total_estimated_hours.count
|
||
|
average = Rational(
|
||
|
child_with_total_estimated_hours.sum(&:total_estimated_hours).to_d,
|
||
|
child_with_total_estimated_hours.count
|
||
|
)
|
||
|
else
|
||
|
average = BigDecimal('1.0')
|
||
|
average = Rational(1)
|
||
|
end
|
||
|
done = children.sum do |c|
|
||
|
estimated = (c.total_estimated_hours || 0.0).to_d
|
||
|
estimated = Rational(c.total_estimated_hours&.to_d || 0)
|
||
|
estimated = average unless estimated > 0.0
|
||
|
ratio = c.closed? ? 100 : (c.done_ratio || 0)
|
||
|
estimated * ratio
|
||
|
end
|
||
|
progress = done / (average * children.count)
|
||
|
progress = Rational(done, average * children.count)
|
||
|
p.done_ratio = progress.floor
|
||
|
end
|
||
|
end
|
||
- « Previous
- 1
- 2
- 3
- 4
- Next »