From f1bfed4b511a9f262afa9a68fea0070c7fbb13bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacobo=20Aragunde=20P=C3=A9rez?= Date: Thu, 17 Jun 2010 10:52:48 +0200 Subject: [PATCH] ItEr60S04ValidacionEProbasFuncionaisItEr59S04: [Bug #532] Fix bug, retrieve correctly the DayAssignments from the selected Criteria when in 'filter by criteria' mode. --- .../web/resourceload/ResourceLoadModel.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/resourceload/ResourceLoadModel.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/resourceload/ResourceLoadModel.java index 9cc235c7c..45fd68611 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/resourceload/ResourceLoadModel.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/resourceload/ResourceLoadModel.java @@ -220,11 +220,15 @@ public class ResourceLoadModel implements IResourceLoadModel { if (filterByResources) { result.addAll(groupsFor(resourcesToShow())); } else { - result.addAll(groupsFor(genericAllocationsByCriterion())); + calculatedGenericAllocationsByCriterion = + genericAllocationsByCriterion(); + result.addAll(groupsFor(calculatedGenericAllocationsByCriterion)); } return result; } + Map> calculatedGenericAllocationsByCriterion; + private Map> genericAllocationsByCriterion() { if (!criteriaToShowList.isEmpty()) { reattachCriteriaToShow(); @@ -856,8 +860,22 @@ public class ResourceLoadModel implements IResourceLoadModel { @Transactional(readOnly = true) public List getDayAssignments() { - return dayAssignmentDAO.findByResources(scenarioManager.getCurrent(), - getResources()); + if(filterByResources) { + return dayAssignmentDAO.findByResources(scenarioManager.getCurrent(), + getResources()); + } + else { + List dayAssignments = new ArrayList(); + for(Entry> entry : + calculatedGenericAllocationsByCriterion.entrySet()) { + + for(GenericResourceAllocation allocation : entry.getValue()) { + dayAssignments.addAll(allocation.getAssignments()); + } + } + + return dayAssignments; + } } @Override