Bug #1327: Fix issue changing method to do reassignments in consolidation process

The problem was that ResourceAllocation.DayAssignmentsState has a wrong start
day for consolidated tasks.

During the consolidation the method used to do the reassignment called
ResourceAllocation.allocateTheWholeAllocation which changed DayAssignmentsState
start date to first day not consolidated. Now this method is avoided, and the
start date in DayAssignmentsState is right.

FEA: ItEr76S04BugFixing
This commit is contained in:
Manuel Rego Casasnovas 2012-01-09 18:06:46 +01:00
parent 205a3f4b6a
commit 19da66e5fa

View file

@ -218,7 +218,8 @@ public class AdvanceConsolidationModel implements IAdvanceConsolidationModel {
if (value.getDate().compareTo(end.getDate().minusDays(1)) >= 0) {
reassignExpandingTask(allResourceAllocations);
} else {
reassignAll(end, allResourceAllocations);
reassignAll(task.getIntraDayStartDate(), end,
allResourceAllocations);
}
resetIntendedResourcesPerDayWithNonConsolidated(allResourceAllocations);
@ -238,19 +239,19 @@ public class AdvanceConsolidationModel implements IAdvanceConsolidationModel {
}
}
private void reassignAll(IntraDayDate end,
private void reassignAll(IntraDayDate start, IntraDayDate end,
Collection<? extends ResourceAllocation<?>> allocations) {
for (ResourceAllocation<?> each : allocations) {
EffortDuration pendingEffort = consolidation
.getNotConsolidated(each.getIntendedTotalAssigment());
reassign(each, end, pendingEffort);
reassign(each, start, end, pendingEffort);
}
}
private void reassign(ResourceAllocation<?> resourceAllocation,
IntraDayDate end, EffortDuration pendingEffort) {
IntraDayDate start, IntraDayDate end, EffortDuration pendingEffort) {
resourceAllocation.withPreviousAssociatedResources()
.fromStartUntil(end).allocate(pendingEffort);
.onInterval(start, end).allocate(pendingEffort);
}
private void reassignExpandingTask(
@ -326,7 +327,8 @@ public class AdvanceConsolidationModel implements IAdvanceConsolidationModel {
.getAllResourceAllocations();
withDetachOnDayAssignmentRemoval(allResourceAllocations);
reassignAll(task.getIntraDayEndDate(), allResourceAllocations);
reassignAll(task.getIntraDayStartDate(), task.getIntraDayEndDate(),
allResourceAllocations);
resetIntendedResourcesPerDayWithNonConsolidated(allResourceAllocations);
}