diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/AggregateOfResourceAllocations.java b/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/AggregateOfResourceAllocations.java index 2593ebb6e..e09c79186 100644 --- a/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/AggregateOfResourceAllocations.java +++ b/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/AggregateOfResourceAllocations.java @@ -103,6 +103,13 @@ public class AggregateOfResourceAllocations { return end != null ? end.getDate() : null; } + /** + * Calculates the latest end of all the allocations of this aggregate + * + * @return + * @throws IllegalStateException + * if the aggregate is empty + */ public IntraDayDate getEnd() { if (isEmpty()) { throw new IllegalStateException("the aggregate is empty"); diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AllocationResult.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AllocationResult.java index 5017af194..07d094fc7 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AllocationResult.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AllocationResult.java @@ -103,7 +103,7 @@ public class AllocationResult { this.aggregate = aggregate; this.daysDuration = aggregate.isEmpty() ? task.getDaysDuration() : aggregate.getDaysDuration(); - this.end = aggregate.getEnd(); + this.end = aggregate.isEmpty() ? null : aggregate.getEnd(); this.newAllocations = newAllocations; this.modified = modified; }