What I did in some of my apps is basically this:
- Use a custom form to add bookings, mostly for the ability to check for duplicated bookings.
-
Use an event picker component for users to add new bookings, so they can see what has been booked, thus reduce the chance that they will add a duplicated one.
-
Use two single value columns to cast the desired starting and ending times to the table where I store existing bookings.
-
The logic starts from here, I usually create 4 columns to get the relative position of the desired starting and ending times, against existing starting and ending times. What I wanna check is if the desired time is before the existing time.
-
Let’s start with “Desired Starting vs Existing Starting”, if desired starting is before existing starting then true, else false. We do the same for the other 3 cases: “Desired Starting vs Existing Ending”, “Desired Ending vs Existing Starting” and “Desired Ending vs Existing Ending”.
-
Then, I create two template columns to get the combined boolean for:
“Starting Check”: Desired Starting vs Existing Starting combined with Desired Ending vs Existing Starting
“Ending Check”: Desired Starting vs Existing Ending combined with Desired Ending vs Existing Ending
- If my thought is right, there are only 2 cases that a new booking can not be duplicated, they’re the two black ranges below.
- Hence, final if then else column, if Starting Check is true - true then not duplicated, if Ending Check is true - true then not duplicated, else duplicated.