[Bug #676] Fix bug
The taken effort must be added to the effort taken by the day. Otherwise if the start date is in the middle of the day and the allocation finishes the same day the calculated end is wrong. FEA: ItEr62S05BugFixing
This commit is contained in:
parent
643de53a0e
commit
6b07e6c7f6
2 changed files with 15 additions and 1 deletions
|
|
@ -99,7 +99,8 @@ public abstract class AllocatorForSpecifiedResourcesPerDayAndHours {
|
|||
lastDate = current;
|
||||
taken = assignForDay(resourcesPerDayModification,
|
||||
dayStartingAt(current), effortRemaining);
|
||||
lastDate = IntraDayDate.create(current.getDate(), taken);
|
||||
lastDate = IntraDayDate.create(current.getDate(),
|
||||
taken.plus(current.getEffortDuration()));
|
||||
effortRemaining = effortRemaining.minus(taken);
|
||||
}
|
||||
if (resourcesPerDayModification.isDayFilled(lastDate.getDate(),
|
||||
|
|
|
|||
|
|
@ -135,6 +135,19 @@ public class AllocationUntilFillingHoursTest {
|
|||
equalTo(ResourcesPerDay.amount(1)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void theEndDateIsCalculatedCorrectlyIfTheStartIsInTheMiddleOfADayAndEndsTheSameDay() {
|
||||
givenStartDate(IntraDayDate.create(new LocalDate(2009, 10, 10),
|
||||
EffortDuration.hours(2)));
|
||||
givenSpecificAllocations(ResourcesPerDay.amount(1));
|
||||
ResourceAllocation.allocating(allocations).untilAllocating(4);
|
||||
ResourceAllocation<?> allocation = allocations.get(0)
|
||||
.getBeingModified();
|
||||
assertThat(allocation.getIntraDayEndDate(),
|
||||
equalTo(IntraDayDate.create(new LocalDate(2009, 10, 10),
|
||||
EffortDuration.hours(6))));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void theResourcesPerDayAreKeptCorrectlyCalculatedAfterUpdatingTheEndInterval() {
|
||||
final ResourcesPerDay oneResourcePerDay = ResourcesPerDay.amount(1);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue