Bug #1413: Fix bug
Fix the bug for when calculating the hours. FEA: ItEr77S04BugFixing
This commit is contained in:
parent
e1fbcd6ac9
commit
bd29c64fe5
7 changed files with 46 additions and 17 deletions
|
|
@ -34,6 +34,10 @@ public interface IAllocatable extends IAllocateResourcesPerDay {
|
|||
|
||||
public IAllocateResourcesPerDay resourcesPerDayFromEndUntil(LocalDate start);
|
||||
|
||||
public IAllocateResourcesPerDay resourcesPerDayUntil(IntraDayDate endExclusive);
|
||||
|
||||
public IAllocateResourcesPerDay resourcesPerDayFromEndUntil(IntraDayDate start);
|
||||
|
||||
/**
|
||||
* @see IAllocatable#onIntervalWithinTask(IntraDayDate, IntraDayDate)
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -436,13 +436,13 @@ public abstract class ResourceAllocation<T extends DayAssignment> extends
|
|||
allocator.allocateOnTaskLength();
|
||||
}
|
||||
|
||||
public void allocateUntil(LocalDate endExclusive) {
|
||||
public void allocateUntil(IntraDayDate endExclusive) {
|
||||
AllocatorForTaskDurationAndSpecifiedResourcesPerDay allocator = new AllocatorForTaskDurationAndSpecifiedResourcesPerDay(
|
||||
allocations);
|
||||
allocator.allocateUntil(endExclusive);
|
||||
}
|
||||
|
||||
public void allocateFromEndUntil(LocalDate start) {
|
||||
public void allocateFromEndUntil(IntraDayDate start) {
|
||||
AllocatorForTaskDurationAndSpecifiedResourcesPerDay allocator = new AllocatorForTaskDurationAndSpecifiedResourcesPerDay(
|
||||
allocations);
|
||||
allocator.allocateFromEndUntil(start);
|
||||
|
|
@ -775,16 +775,26 @@ public abstract class ResourceAllocation<T extends DayAssignment> extends
|
|||
|
||||
@Override
|
||||
public IAllocateResourcesPerDay resourcesPerDayUntil(final LocalDate endExclusive) {
|
||||
return resourcesPerDayUntil(IntraDayDate.startOfDay(endExclusive));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllocateResourcesPerDay resourcesPerDayUntil(IntraDayDate end) {
|
||||
IntraDayDate startInclusive = getStartSpecifiedByTask();
|
||||
IntraDayDate end = IntraDayDate.startOfDay(endExclusive);
|
||||
return new AllocateResourcesPerDayOnInterval(startInclusive, end);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllocateResourcesPerDay resourcesPerDayFromEndUntil(
|
||||
LocalDate start) {
|
||||
IntraDayDate startInclusive = IntraDayDate.max(
|
||||
IntraDayDate.startOfDay(start), getStartSpecifiedByTask());
|
||||
return resourcesPerDayFromEndUntil(IntraDayDate.startOfDay(start));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllocateResourcesPerDay resourcesPerDayFromEndUntil(
|
||||
IntraDayDate start) {
|
||||
IntraDayDate startInclusive = IntraDayDate.max(start,
|
||||
getStartSpecifiedByTask());
|
||||
IntraDayDate endDate = task.getIntraDayEndDate();
|
||||
return new AllocateResourcesPerDayOnInterval(startInclusive,
|
||||
endDate);
|
||||
|
|
|
|||
|
|
@ -176,6 +176,20 @@ public class SpecificResourceAllocation extends
|
|||
return allocator.resourcesPerDayFromEndUntil(start);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllocateResourcesPerDay resourcesPerDayUntil(
|
||||
IntraDayDate endExclusive) {
|
||||
return new SpecificAssignmentsAllocator()
|
||||
.resourcesPerDayUntil(endExclusive);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllocateResourcesPerDay resourcesPerDayFromEndUntil(
|
||||
IntraDayDate start) {
|
||||
SpecificAssignmentsAllocator allocator = new SpecificAssignmentsAllocator();
|
||||
return allocator.resourcesPerDayFromEndUntil(start);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAllocateEffortOnInterval fromStartUntil(LocalDate endExclusive) {
|
||||
return new SpecificAssignmentsAllocator().fromStartUntil(endExclusive);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ package org.libreplan.business.planner.entities.allocationalgorithms;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.libreplan.business.workingday.IntraDayDate;
|
||||
|
||||
public class AllocatorForTaskDurationAndSpecifiedResourcesPerDay {
|
||||
|
||||
|
|
@ -40,13 +40,13 @@ public class AllocatorForTaskDurationAndSpecifiedResourcesPerDay {
|
|||
}
|
||||
}
|
||||
|
||||
public void allocateUntil(LocalDate endExclusive) {
|
||||
public void allocateUntil(IntraDayDate endExclusive) {
|
||||
for (ResourcesPerDayModification allocation : allocations) {
|
||||
allocation.applyAllocationUntil(endExclusive);
|
||||
}
|
||||
}
|
||||
|
||||
public void allocateFromEndUntil(LocalDate start) {
|
||||
public void allocateFromEndUntil(IntraDayDate start) {
|
||||
for (ResourcesPerDayModification allocation : allocations) {
|
||||
allocation.applyAllocationFromEndUntil(start);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,13 +72,13 @@ public abstract class ResourcesPerDayModification extends
|
|||
}
|
||||
|
||||
@Override
|
||||
public void applyAllocationUntil(LocalDate endExclusive) {
|
||||
public void applyAllocationUntil(IntraDayDate endExclusive) {
|
||||
genericAllocation.forResources(getResources())
|
||||
.resourcesPerDayUntil(endExclusive).allocate(getGoal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyAllocationFromEndUntil(LocalDate start) {
|
||||
public void applyAllocationFromEndUntil(IntraDayDate start) {
|
||||
genericAllocation.forResources(getResources())
|
||||
.resourcesPerDayFromEndUntil(start).allocate(getGoal());
|
||||
}
|
||||
|
|
@ -153,13 +153,13 @@ public abstract class ResourcesPerDayModification extends
|
|||
}
|
||||
|
||||
@Override
|
||||
public void applyAllocationUntil(LocalDate endExclusive) {
|
||||
public void applyAllocationUntil(IntraDayDate endExclusive) {
|
||||
resourceAllocation.resourcesPerDayUntil(endExclusive).allocate(
|
||||
getGoal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyAllocationFromEndUntil(LocalDate start) {
|
||||
public void applyAllocationFromEndUntil(IntraDayDate start) {
|
||||
resourceAllocation.resourcesPerDayFromEndUntil(start).allocate(
|
||||
getGoal());
|
||||
}
|
||||
|
|
@ -272,9 +272,9 @@ public abstract class ResourcesPerDayModification extends
|
|||
|
||||
public abstract void applyAllocationOnAllTaskLength();
|
||||
|
||||
public abstract void applyAllocationUntil(LocalDate endExclusive);
|
||||
public abstract void applyAllocationUntil(IntraDayDate endExclusive);
|
||||
|
||||
public abstract void applyAllocationFromEndUntil(LocalDate start);
|
||||
public abstract void applyAllocationFromEndUntil(IntraDayDate start);
|
||||
|
||||
public IAssignmentsCreator createAssignmentsCreator() {
|
||||
|
||||
|
|
|
|||
|
|
@ -480,7 +480,8 @@ public class GenericResourceAllocationTest {
|
|||
ResourcesPerDay resourcesPerDay = ResourcesPerDay.amount(1);
|
||||
|
||||
genericResourceAllocation.forResources(Arrays.asList(worker1))
|
||||
.resourcesPerDayUntil(null).allocate(resourcesPerDay);
|
||||
.resourcesPerDayUntil((IntraDayDate) null)
|
||||
.allocate(resourcesPerDay);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -298,10 +298,10 @@ public class AllocationRowsHandler {
|
|||
.createAndAssociate(task, currentRows, requestedToRemove);
|
||||
if (isForwardsAllocation()) {
|
||||
ResourceAllocation.allocating(allocations).allocateUntil(
|
||||
formBinder.getAllocationEnd().asExclusiveEnd());
|
||||
formBinder.getAllocationEnd());
|
||||
} else {
|
||||
ResourceAllocation.allocating(allocations).allocateFromEndUntil(
|
||||
formBinder.getAllocationStart().getDate());
|
||||
formBinder.getAllocationStart());
|
||||
}
|
||||
return allocations;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue