Added method isConsolidated()
Advance function (stretches, interpolated) cannot be applied on consolidated intervals. FEA: ItEr74S04BugFixing
This commit is contained in:
parent
5b5c5cbf56
commit
efa5cafb82
2 changed files with 22 additions and 11 deletions
|
|
@ -107,10 +107,12 @@ public class Stretch {
|
|||
@NotNull
|
||||
private BigDecimal amountWorkPercentage = BigDecimal.ZERO;
|
||||
|
||||
// Trasient value, a stretch is readOnly if it's a consolidated stretch
|
||||
// or if it is a stretch user cannot edit
|
||||
// Transient value, a stretch is readOnly if it is a stretch user cannot edit
|
||||
private boolean readOnly = false;
|
||||
|
||||
// Transient value, a stretch is consolidated if it's a consolidated stretch
|
||||
private boolean consolidated = false;
|
||||
|
||||
private Stretch(LocalDate date, BigDecimal lengthPercent, BigDecimal progressPercent) {
|
||||
this.date = date;
|
||||
this.lengthPercentage = lengthPercent;
|
||||
|
|
@ -181,6 +183,14 @@ public class Stretch {
|
|||
readOnly = value;
|
||||
}
|
||||
|
||||
public boolean isConsolidated() {
|
||||
return consolidated;
|
||||
}
|
||||
|
||||
public void consolidated(boolean value) {
|
||||
consolidated = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -210,6 +220,7 @@ class ConsolidatedStretch {
|
|||
Task task) {
|
||||
Stretch result = Stretch.create(date, task, advancePercentage);
|
||||
result.readOnly(true);
|
||||
result.consolidated(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,12 +56,12 @@ public class StretchesFunction extends AssignmentFunction {
|
|||
|
||||
private final BigDecimal loadProportion;
|
||||
|
||||
private boolean readOnly = false;
|
||||
private boolean consolidated = false;
|
||||
|
||||
public static Interval create(BigDecimal loadProportion, LocalDate start,
|
||||
LocalDate end, boolean readOnly) {
|
||||
LocalDate end, boolean consolidated) {
|
||||
Interval result = create(loadProportion, start, end);
|
||||
result.readOnly(readOnly);
|
||||
result.consolidated(consolidated);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ public class StretchesFunction extends AssignmentFunction {
|
|||
private void apply(ResourceAllocation<?> resourceAllocation,
|
||||
LocalDate startInclusive, LocalDate taskEnd,
|
||||
int intervalHours) {
|
||||
Validate.isTrue(!isReadOnly());
|
||||
Validate.isTrue(!isConsolidated());
|
||||
|
||||
// End has to be exclusive on last Stretch
|
||||
LocalDate endDate = getEnd();
|
||||
|
|
@ -187,12 +187,12 @@ public class StretchesFunction extends AssignmentFunction {
|
|||
return String.format("[%s, %s]: %s ", start, end, loadProportion);
|
||||
}
|
||||
|
||||
public boolean isReadOnly() {
|
||||
return readOnly;
|
||||
public void consolidated(boolean value) {
|
||||
consolidated = value;
|
||||
}
|
||||
|
||||
public void readOnly(boolean value) {
|
||||
readOnly = value;
|
||||
public boolean isConsolidated() {
|
||||
return consolidated;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -232,7 +232,7 @@ public class StretchesFunction extends AssignmentFunction {
|
|||
loadedProportion = BigDecimal.ZERO;
|
||||
}
|
||||
result.add(Interval.create(loadedProportion, previous,
|
||||
stretchDate, each.isReadOnly()));
|
||||
stretchDate, each.isConsolidated()));
|
||||
sumOfProportions = each.getAmountWorkPercentage();
|
||||
previous = stretchDate;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue