I’m developing a reservation app and am having trouble blocking out the ‘time blocks’ that a reservation occupies. Time slots like 12:00, 12:15, 12:30, etc., are text-based.
The way my app functions is that when the user inputs the number of guests and the date, the ‘reservations for the day’ repeating group, which is hidden, will display the elements that match the date and time. I also have another hidden repeating group, ‘full tables’, where I group the number of reservations for that time slot. If this reaches the restaurant’s set limit for the maximum number of reservations accepted for the number of guests entered, the time slot will then disappear from the repeating group where the user can select times.
When the restaurant has only one table, say for 2 people, I don’t encounter any issues, because the ‘start time’ is grouped in the ‘full tables’ repeating group, and thus the timeslot disappears from the repeating group that shows the available times. It’s worth noting that for each reservation, say for 12:00, I also configure the system to save the time slots 12:15, 12:30, 12:45 as ‘occupied time blocks’. This information also appears in the ‘full tables’ repeating group and blocks out in the repeating group that shows the available times to book.
The problem I’m facing is when a restaurant has two tables for 2 people and the available times are 12:00, 12:15, 12:30, 12:45. If two users make two different reservations, one at 12:00 and another at 12:15, the repeating group that shows available times continues to show that there are tables available for 12:00, 12:15, 12:30, and 12:45, when in reality, both tables are already occupied. This could potentially lead to overbooking.
I’m posting this to see if anyone has an idea of how I might tackle this problem. I’ve been looking for a solution for a week now and still haven’t come up with one. Any help would be greatly appreciated."