From bcc4103cfe5d90c8ea724f70f47f4f88a279a306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20Gonz=C3=A1lez=20Fern=C3=A1ndez?= Date: Tue, 2 Mar 2010 20:57:16 +0100 Subject: [PATCH] ItEr49S04ValidacionEProbasFuncionaisItEr48S04: Limiting the assignation of the advanced assignation to always days after or equal start of the task. --- .../AdvancedAllocationController.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AdvancedAllocationController.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AdvancedAllocationController.java index 415a9e63a..1bd7ba5e6 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AdvancedAllocationController.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AdvancedAllocationController.java @@ -196,9 +196,8 @@ public class AdvancedAllocationController extends GenericForwardComposer { public static Restriction build(IRestrictionSource restrictionSource) { switch (restrictionSource.getCalculatedValue()) { case END_DATE: - return Restriction - .fixedHours(restrictionSource - .getTotalHours()); + return Restriction.fixedHours(restrictionSource.getStart(), + restrictionSource.getTotalHours()); case NUMBER_OF_HOURS: return Restriction.onlyAssignOnInterval(restrictionSource .getStart(), restrictionSource.getEnd()); @@ -219,8 +218,8 @@ public class AdvancedAllocationController extends GenericForwardComposer { return new OnlyOnIntervalRestriction(start, end); } - private static Restriction fixedHours(int hours) { - return new FixedHoursRestriction(hours); + private static Restriction fixedHours(LocalDate start, int hours) { + return new FixedHoursRestriction(start, hours); } abstract LocalDate limitStartDate(LocalDate startDate); @@ -289,8 +288,10 @@ public class AdvancedAllocationController extends GenericForwardComposer { private static class FixedHoursRestriction extends Restriction { private final int hours; + private final LocalDate start; - private FixedHoursRestriction(int hours) { + private FixedHoursRestriction(LocalDate start, int hours) { + this.start = start; this.hours = hours; } @@ -305,8 +306,8 @@ public class AdvancedAllocationController extends GenericForwardComposer { } @Override - LocalDate limitStartDate(LocalDate startDate) { - return startDate; + LocalDate limitStartDate(LocalDate argStart) { + return start.compareTo(argStart) > 0 ? start : argStart; } @Override