diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AllocationDTO.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AllocationDTO.java index ff1a26a49..757c8aba6 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AllocationDTO.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AllocationDTO.java @@ -65,6 +65,10 @@ public abstract class AllocationDTO { public abstract boolean isGeneric(); + public boolean isEmptyResourcesPerDay() { + return getResourcesPerDay().isZero(); + } + public static List toDTOs( Collection> resourceAllocations) { List result = new ArrayList(); diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/ResourceAllocationsBeingEdited.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/ResourceAllocationsBeingEdited.java index 61ea40883..987ed4ef2 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/ResourceAllocationsBeingEdited.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/ResourceAllocationsBeingEdited.java @@ -100,13 +100,25 @@ public class ResourceAllocationsBeingEdited { public List asResourceAllocations() { List result = new ArrayList(); - for (AllocationDTO allocation : currentAllocations) { + for (AllocationDTO allocation : withoutZeroResourcesPerDayAllocations(currentAllocations)) { result.add(createOrModify(allocation).withDesiredResourcesPerDay( allocation.getResourcesPerDay())); } return result; } + + private List withoutZeroResourcesPerDayAllocations( + List allocations) { + List result = new ArrayList(); + for (AllocationDTO allocationDTO : allocations) { + if (!allocationDTO.isEmptyResourcesPerDay()) { + result.add(allocationDTO); + } + } + return result; + } + public AggregateOfResourceAllocations doAllocation() { List allocations = asResourceAllocations(); switch (calculatedValue) {