Fix bug: Return 0 if budgetAtCompletion has no elements

FEA: ItEr76S15OrganizingPerProjectDashboard
This commit is contained in:
Diego Pino 2012-05-25 11:32:23 +02:00
parent ec4745a100
commit 780120fcb9

View file

@ -103,9 +103,9 @@ public class OrderEarnedValueCalculator extends EarnedValueCalculator implements
@Override
@Transactional(readOnly = true)
public BigDecimal getBudgetAtCompletion(Order order) {
SortedMap<LocalDate, BigDecimal> budgedtedCost = calculateBudgetedCostWorkScheduled(order);
LocalDate lastKey = budgedtedCost.lastKey();
return (lastKey) != null ? budgedtedCost.get(lastKey) : BigDecimal.ZERO;
SortedMap<LocalDate, BigDecimal> budgedtedCost = calculateBudgetedCostWorkScheduled(order);
return !budgedtedCost.isEmpty() ? budgedtedCost.get(budgedtedCost
.lastKey()) : BigDecimal.ZERO;
}
@Override