Bug #1529: Avoid exception in Cost tab in project details

The problem is that SumChargedEffort is null when it shouldn't, so the order is
marked to be recalculated if this is the case.

This is a workaround for the issue described in the bug #1529, while we're not
able to reproduce the problem.

FEA: ItEr77S04BugFixing
This commit is contained in:
Manuel Rego Casasnovas 2012-09-18 19:01:46 +02:00
parent 84d7daf160
commit 7e0295166c

View file

@ -197,9 +197,15 @@ public class AssignedHoursToOrderElementModel implements IAssignedHoursToOrderEl
if (orderElement.getChildren().isEmpty()) {
return EffortDuration.zero();
}
EffortDuration assignedDirectChildren = getTotalAssignedEffort().minus(
this.assignedDirectEffort);
return assignedDirectChildren;
EffortDuration totalAssignedEffort = getTotalAssignedEffort();
// FIXME Once we're able to reproduce and fix the cause of bugs like
// #1529, we could remove this if
if (totalAssignedEffort.compareTo(assignedDirectEffort) < 0) {
orderElement.getOrder()
.markAsNeededToRecalculateSumChargedEfforts();
return EffortDuration.zero();
}
return totalAssignedEffort.minus(this.assignedDirectEffort);
}
@Override