ItEr29S06CUAsignacionGrupoRecursosAPlanificacionItEr28S06: Now calculates the resources per day correctly for generic allocations
This commit is contained in:
parent
2ac95fa1c2
commit
859bac1a01
2 changed files with 23 additions and 2 deletions
|
|
@ -380,8 +380,7 @@ public abstract class ResourceAllocation<T extends DayAssignment> extends
|
|||
int sumWorkableHours = 0;
|
||||
for (Entry<LocalDate, List<DayAssignment>> entry : byDay.entrySet()) {
|
||||
sumWorkableHours += getWorkHoursPerDay().getWorkableHours(
|
||||
entry.getKey())
|
||||
* entry.getValue().size();
|
||||
entry.getKey());
|
||||
sumTotalHours += getAssignedHours(entry.getValue());
|
||||
}
|
||||
if (sumWorkableHours == 0) {
|
||||
|
|
|
|||
|
|
@ -398,4 +398,26 @@ public class GenericResourceAllocationTest {
|
|||
assertThat(genericResourceAllocation.getAssignedHours(), equalTo(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void afterAllocatingMoreHoursOnIntervalTheResourcesPerDayAreIncreased() {
|
||||
final int workableHoursDay = 8;
|
||||
givenBaseCalendarWithoutExceptions(workableHoursDay);
|
||||
LocalDate start = new LocalDate(2006, 10, 5);
|
||||
final int days = 4;
|
||||
givenTaskWithStartAndEnd(toInterval(start, Period.days(days)));
|
||||
givenGenericResourceAllocationForTask(task);
|
||||
givenWorkersWithLoads(8, 8, 8);
|
||||
|
||||
genericResourceAllocation.forResources(workers).allocate(
|
||||
ResourcesPerDay.amount(3));
|
||||
ResourcesPerDay original = genericResourceAllocation
|
||||
.getResourcesPerDay();
|
||||
genericResourceAllocation.forResources(workers).onInterval(start,
|
||||
start.plusDays(2)).allocateHours(60);
|
||||
ResourcesPerDay current = genericResourceAllocation
|
||||
.getResourcesPerDay();
|
||||
assertTrue(current.getAmount()
|
||||
.compareTo(original.getAmount()) > 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue