Commit 6a87475b by Tuomas Riihimäki

If user has reserved places, but has not yet locked them user can not return to …

…place selection and lock the places
1 parent b79c2f77
......@@ -88,7 +88,7 @@ public class AjaxMapView extends GenericCDIView {
if (super.requirePermissions(MapPermission.BUY_PLACES) && map == null) {
EventUser u = userview.getSelectedUser();
EventMap map = initMap();
List<PlaceSlot> usersPlaceslots = placebean.getFreePlaceslots(u, map);
List<PlaceSlot> usersPlaceslots = placebean.getPlaceslots(u);
if (usersPlaceslots.isEmpty()) {
logger.info("There are no placeslots available for user");
......@@ -100,13 +100,12 @@ public class AjaxMapView extends GenericCDIView {
super.navihandler.forward("/neomap/notenoughslots?faces-redirect=true");
} else {
quebean.enterQueue(map, u);
countPlaceslots(usersPlaceslots);
slotcount = countPlaceslots(placebean.getFreePlaceslots(u, map));
}
}
}
private void countPlaceslots(List<PlaceSlot> slots)
private static Collection<Slotcounter> countPlaceslots(List<PlaceSlot> slots)
{
HashMap<Product, Slotcounter> prodmap = new HashMap<Product, Slotcounter>();
for (PlaceSlot p : slots) {
......@@ -115,9 +114,10 @@ public class AjaxMapView extends GenericCDIView {
}
prodmap.get(p.getProduct()).increment();
}
slotcount = prodmap.values();
logger.info("Slotcount size {}", slotcount.size());
Collection<Slotcounter> ret = prodmap.values();
logger.info("Slotcount size {}", ret);
return ret;
}
public void initViewMap() {
......@@ -255,7 +255,7 @@ public class AjaxMapView extends GenericCDIView {
}
public EventMap getMap() {
if(map == null)
if (map == null)
return initMap();
return map;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!