Avoid exception if effortAssigned is zero

Add a warning if this happens and the totalEffort is not zero.

FEA: ItEr70S04BugFixingx
This commit is contained in:
Óscar González Fernández 2011-02-11 16:08:12 +01:00
parent 339f02c931
commit 9532c2b71f

View file

@ -212,6 +212,11 @@ abstract class LoadPeriodGenerator {
if (totalEffort.isZero()) {
return effortAssigned.isZero() ? 0 : Integer.MAX_VALUE;
}
if (effortAssigned.isZero()) {
LOG.warn("total effort is " + totalEffort
+ " but effortAssigned is zero");
return Integer.MAX_VALUE;
}
Fraction fraction = totalEffort.divivedBy(effortAssigned);
Fraction percentage = fraction.multiplyBy(Fraction.getFraction(100, 1));
return percentage.intValue();