From 5112be9c6e2aa9d943b0558d75838e49a0fa71fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20Gonz=C3=A1lez=20Fern=C3=A1ndez?= Date: Tue, 21 Dec 2010 16:53:00 +0100 Subject: [PATCH] [Bug #760] Fix corner case When the calculated value was end date and the task was moved backwards with a new end date that is before to the old start date and the allocation cannot be satisfied, the start date picked would be posterior to the new end. To avoid this, the dates must always be recalculated taking into account the length. FEA: ItEr66S04BugFixing --- .../business/planner/entities/Task.java | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/Task.java b/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/Task.java index a2488a89c..1883a43bb 100644 --- a/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/Task.java +++ b/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/Task.java @@ -231,10 +231,6 @@ public class Task extends TaskElement implements ITaskPositionConstrained { && resourceAllocation.isLimitingAndHasDayAssignments(); } - private boolean isLimitingAndNotAssignedYet() { - return isLimiting() && !isLimitingAndHasDayAssignments(); - } - public void addResourceAllocation(ResourceAllocation resourceAllocation) { addResourceAllocation(resourceAllocation, true); } @@ -471,11 +467,7 @@ public class Task extends TaskElement implements ITaskPositionConstrained { if (previousStart.equals(newStartDate)) { return; } - if (calculatedValue != CalculatedValue.END_DATE - || getSatisfiedResourceAllocations().isEmpty() - || isLimitingAndNotAssignedYet()) { - setIntraDayEndDate(calculateEndKeepingLength(newStartDate)); - } + setIntraDayEndDate(calculateEndKeepingLength(newStartDate)); setIntraDayStartDate(newStartDate); doReassignment(Direction.FORWARD); } @@ -490,10 +482,7 @@ public class Task extends TaskElement implements ITaskPositionConstrained { if (getIntraDayEndDate().equals(newEnd)) { return; } - if (calculatedValue != CalculatedValue.END_DATE - || getSatisfiedResourceAllocations().isEmpty()) { - setIntraDayStartDate(calculateNewStartGivenEnd(newEnd)); - } + setIntraDayStartDate(calculateNewStartGivenEnd(newEnd)); setIntraDayEndDate(newEnd); doReassignment(Direction.BACKWARD); }