Commit 89c54ec5 by Juho Juopperi

Merge branch 'placeselect' into 'master'

Placeselect

When user is using placeslots (ie. selecting places) and for some reason leaves the page when all placeslots are in use, user can not return to the page to lock the places...

Change logic so that if user has any placeslots (used or not), place selecting page can be entered.

See merge request !250
2 parents 1f25944b 6a87475b
......@@ -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() {
......@@ -139,7 +139,7 @@ public class AjaxMapView extends GenericCDIView {
{
logger.info("Entering queue");
if (isQueueEnabled())
queueEntry = quebean.enterQueue(initMap(), userview.getSelectedUser());
queueEntry = quebean.enterQueue(initMap(), userview.getSelectedUser());
else {
logger.warn("QueueNot enabled. Not entering queue");
}
......@@ -167,7 +167,7 @@ public class AjaxMapView extends GenericCDIView {
}
public Integer getQueuePosition() {
return quebean.getQueuePosition(initMap(), userview.getSelectedUser());
return quebean.getQueuePosition(initMap(), userview.getSelectedUser());
}
public Long getPlacesLeftToSelect() {
......@@ -194,7 +194,7 @@ public class AjaxMapView extends GenericCDIView {
public boolean isReserving()
{
if (reserving == null) {
reserving = quebean.isReserving(initMap(), userview.getSelectedUser());
reserving = quebean.isReserving(initMap(), userview.getSelectedUser());
}
return reserving;
}
......@@ -202,7 +202,7 @@ public class AjaxMapView extends GenericCDIView {
public boolean canUserBuy() {
return permbean.hasPermission(MapPermission.BUY_PLACES) &&
(permbean.hasPermission(MapPermission.MANAGE_OTHERS) ||
quebean.isReserving(initMap(), userview.getSelectedUser())
quebean.isReserving(initMap(), userview.getSelectedUser())
);
}
......@@ -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!