ItEr27S07CUVistaRecursosTempoPorProxectoItEr26S08: It allows to put the generic allocation to zero
This commit is contained in:
parent
740192980d
commit
2e057952c8
2 changed files with 17 additions and 1 deletions
|
|
@ -65,6 +65,10 @@ public abstract class AllocationDTO {
|
|||
|
||||
public abstract boolean isGeneric();
|
||||
|
||||
public boolean isEmptyResourcesPerDay() {
|
||||
return getResourcesPerDay().isZero();
|
||||
}
|
||||
|
||||
public static List<AllocationDTO> toDTOs(
|
||||
Collection<? extends ResourceAllocation<?>> resourceAllocations) {
|
||||
List<AllocationDTO> result = new ArrayList<AllocationDTO>();
|
||||
|
|
|
|||
|
|
@ -100,13 +100,25 @@ public class ResourceAllocationsBeingEdited {
|
|||
|
||||
public List<ResourceAllocationWithDesiredResourcesPerDay> asResourceAllocations() {
|
||||
List<ResourceAllocationWithDesiredResourcesPerDay> result = new ArrayList<ResourceAllocationWithDesiredResourcesPerDay>();
|
||||
for (AllocationDTO allocation : currentAllocations) {
|
||||
for (AllocationDTO allocation : withoutZeroResourcesPerDayAllocations(currentAllocations)) {
|
||||
result.add(createOrModify(allocation).withDesiredResourcesPerDay(
|
||||
allocation.getResourcesPerDay()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private List<AllocationDTO> withoutZeroResourcesPerDayAllocations(
|
||||
List<AllocationDTO> allocations) {
|
||||
List<AllocationDTO> result = new ArrayList<AllocationDTO>();
|
||||
for (AllocationDTO allocationDTO : allocations) {
|
||||
if (!allocationDTO.isEmptyResourcesPerDay()) {
|
||||
result.add(allocationDTO);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public AggregateOfResourceAllocations doAllocation() {
|
||||
List<ResourceAllocationWithDesiredResourcesPerDay> allocations = asResourceAllocations();
|
||||
switch (calculatedValue) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue