[Bug #908] Total amount of allocated hours miscalculated in lineal interpolation (Streches function)

As the end is exclusive, it's needed to increment the endDate in one day for the last Stretch

FEA: ItEr72S04BugFixing
This commit is contained in:
Diego Pino Garcia 2011-03-07 18:19:33 +01:00
parent 189fa05338
commit 475f5c7c0f

View file

@ -255,11 +255,15 @@ public class StretchesFunction extends AssignmentFunction {
}
private void apply(ResourceAllocation<?> resourceAllocation,
LocalDate startInclusive, LocalDate endExclusive,
LocalDate startInclusive, LocalDate taskEnd,
int intervalHours) {
// End has to be exclusive on last Stretch
LocalDate endDate = getEnd();
if (endDate.equals(taskEnd)) {
endDate = endDate.plusDays(1);
}
resourceAllocation.withPreviousAssociatedResources()
.onIntervalWithinTask(getStartFor(startInclusive),
getEnd())
.onIntervalWithinTask(getStartFor(startInclusive), endDate)
.allocateHours(intervalHours);
}
@ -279,7 +283,7 @@ public class StretchesFunction extends AssignmentFunction {
interval.apply(allocation, allocationStart, allocationEnd,
hoursPerInterval[i++]);
}
Validate.isTrue(totalHours == allocation.getAssignedHours());
}
private static int[] getHoursPerInterval(