[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.

FEA: ItEr75S04BugFixing
This commit is contained in:
Lorenzo Tilve Álvaro 2011-10-06 13:19:50 +02:00
parent 88bbc256e2
commit 24b0cf6db5

View file

@ -352,7 +352,8 @@ public class EffortDuration implements Comparable<EffortDuration> {
}
public static EffortDuration average(EffortDuration total, int items) {
return EffortDuration.seconds(total.seconds / items);
return EffortDuration.seconds((items != 0) ? (total.seconds / items)
: total.seconds);
}
private static int roundHalfUpToHours(