[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
This commit is contained in:
Óscar González Fernández 2010-12-21 16:53:00 +01:00
parent edf8bab805
commit 5112be9c6e

View file

@ -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);
}