microsoft / powerapps-tools

Unsupported PowerApps Tools & Apps
MIT License
1.04k stars 432 forks source link

[BUG] Users can exceed the capacity for a space. #456

Open kf-paulbrown opened 4 years ago

kf-paulbrown commented 4 years ago

Hi, we have adapted this app into a desk booking system for our return to the office and have foudn the following bug:

Each space (renamed "desk" in our case) is created in a building (which we've renamed "neighbourhood") with a capacity of 1. If two users have the same neighbourhood and date open in the app they will both see that a desk is free. If they both click to book then it will allow 2 bookings against a desk that has a capacity of 1. After an app refresh this desk will then show as booked but with an availability of -1.

I have tried adding a timer to the page to refresh the gallery but can't seem to get this timer refresh working. Any other suggestions as to how we can prevent this as we're getting multiple people turning up to use a single desk?

cristianoag commented 4 years ago

Well, I think the approach you're using will affect the reports and other things. That is because we use the fact that users worked in the same space to derive when they potentially have contact with each other. I recommend you to take a look in the 1.15 build and check if the feature to reserve tables/workspaces can be used in your case.

Updated Package (v1.15) http://aka.ms/bar115

kf-paulbrown commented 4 years ago

Thanks, do you have a full list of changes/fixes/improvements for v1.15?

Also, for info would you be able to suggest a quick fix to use temporarily to sole the issue above? A time with an OnTimerEnd=Refresh(colFloors) seemed like it would work but hasn't.

cristianoag commented 4 years ago

Here you can find the list of fixes/new features https://github.com/microsoft/powerapps-tools/issues/366#issuecomment-689781116

When you have such a low number of available positions per space you can find yourself in a concurrency scenario that was not thought initially for the app. The approval process when spaces get scarse is supposed to deal with the concurrency in conventional implementations, where spaces have more capacity. The refresh doesn't work cause the collection is an instance for each user, you would need to commit a flag to the database to avoid the racing condition IMHO.

d7235j commented 4 years ago

Via canvas app, the bug is experienced only when user has selected their default facility for booking. App does not prevent selection of default facility/area where capacity is 0. If not default facility, user can not select to book an area where capacity is none.