[Bug #1202] Managed division by zero calculating template averages
It's valid to return a 0 value when the the template has never been asigned, so
there are 0 items to calculate the average used time.
Based in previous patch by Lorenzo Tilve Álvaro <ltilve@igalia.com>:
24b0cf6db5
FEA: ItEr75S04BugFixing
This commit is contained in:
parent
961b24c566
commit
8d05620aff
1 changed files with 2 additions and 1 deletions
|
|
@ -291,7 +291,8 @@ public class OrderElementDAO extends IntegrationEntityDAO<OrderElement>
|
|||
public EffortDuration calculateAverageWorkedHours(
|
||||
final List<OrderElement> list) {
|
||||
EffortDuration sum = sumWorkedHours(list);
|
||||
return EffortDuration.average(sum, list.size());
|
||||
return (list.size() == 0) ? EffortDuration.zero() : EffortDuration
|
||||
.average(sum, list.size());
|
||||
}
|
||||
|
||||
private BigDecimal average(BigDecimal divisor, BigDecimal sum) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue