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