ItEr59S04ValidacionEProbasFuncionaisItEr58S04: [Bug #482] Fix bug.
For elements with generic allocations the resource can't be retrieved. Returning it from GapOnQueue.
This commit is contained in:
parent
37c7df04d6
commit
ca2a233ec1
2 changed files with 8 additions and 3 deletions
|
|
@ -26,6 +26,9 @@ import java.util.ListIterator;
|
|||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.navalplanner.business.calendars.entities.ResourceCalendar;
|
||||
import org.navalplanner.business.planner.limiting.entities.Gap.GapOnQueue;
|
||||
import org.navalplanner.business.resources.entities.Resource;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -80,14 +83,16 @@ public class GapRequirements {
|
|||
.isAfter(gapEnd));
|
||||
}
|
||||
|
||||
public AllocationOnGap guessValidity(Gap gap) {
|
||||
public AllocationOnGap guessValidity(GapOnQueue gapOnQueue) {
|
||||
Gap gap = gapOnQueue.getGap();
|
||||
if (!isPotentiallyValid(gap)) {
|
||||
return AllocationOnGap.invalidOn(gap);
|
||||
}
|
||||
DateAndHour realStart = DateAndHour.Max(earliestPossibleStart, gap
|
||||
.getStartTime());
|
||||
Resource resource = gapOnQueue.getOriginQueue().getResource();
|
||||
List<Integer> hours = gap.getHoursInGapUntilAllocatingAndGoingToTheEnd(
|
||||
element.getResource().getCalendar(), realStart,
|
||||
resource.getCalendar(), realStart,
|
||||
earliestPossibleEnd, element.getIntentedTotalHours());
|
||||
int total = sum(hours);
|
||||
if (total < element.getIntentedTotalHours()) {
|
||||
|
|
|
|||
|
|
@ -413,7 +413,7 @@ public class LimitingResourceQueueModel implements ILimitingResourceQueueModel {
|
|||
for (GapOnQueue eachSubGap : getSubGaps(each, requirements
|
||||
.getElement(), generic)) {
|
||||
AllocationOnGap allocation = requirements
|
||||
.guessValidity(eachSubGap.getGap());
|
||||
.guessValidity(eachSubGap);
|
||||
if (allocation.isValid()) {
|
||||
doAllocation(requirements, allocation, eachSubGap.getOriginQueue());
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue