ItEr59S04ValidacionEProbasFuncionaisItEr58S04: [Bug #497] Resources are reloaded in order to show the load chart.

While allocating DayAssignments are resources are changed, but Order.getResources() still returns the old resources with the original DayAssignments. This list of resources is reloaded in order to get just the new DayAssignments.
This commit is contained in:
Manuel Rego Casasnovas 2010-06-11 08:12:05 +02:00 committed by Javier Moran Rua
parent 5aba8ae2bb
commit 75017c9fe8

View file

@ -1092,7 +1092,7 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel {
SortedMap<LocalDate, Map<Resource, Integer>> orderDayAssignmentsGrouped = groupDayAssignmentsByDayAndResource(orderDayAssignments);
List<DayAssignment> resourcesDayAssignments = new ArrayList<DayAssignment>();
for (Resource resource : order.getResources()) {
for (Resource resource : reloadResources(order.getResources())) {
resourcesDayAssignments.addAll(resource.getAssignments());
}
SortedMap<LocalDate, Map<Resource, Integer>> resourceDayAssignmentsGrouped = groupDayAssignmentsByDayAndResource(resourcesDayAssignments);
@ -1145,6 +1145,17 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel {
chart.setHeight("150px");
}
private List<Resource> reloadResources(
Collection<? extends Resource> resources) {
List<Resource> result = new ArrayList<Resource>();
for (Resource each : resources) {
Resource reloaded = resourceDAO
.findExistingEntity(each.getId());
result.add(reloaded);
}
return result;
}
private void resetMaps() {
mapOrderLoad.clear();
mapOrderOverload.clear();