Jump to content
Sign in to follow this  
Merit Solutions

Catching double bookings based on time

Recommended Posts

I have a booking system where events are booked on a particular date at a particular time. The events are often late in the evening and end early am the next day. I need to ensure that an event is not booked for the same venue at a time that may conflict with an existing booking. The problem I am finding is the fact that 3:00 am is later than 10pm the night before. I need a way using a relationship to catch potential overlapping times. Could anyone help please, it's doing my head in and I'm sure there is a straightforward solution?

Share this post


Link to post
Share on other sites

Use a timestamp instead of date and time (or calculate the timestamp from the entered date and time).

The relationship needs to be:

Events::VenueID = Events 2::VenueID

AND

Events::Start ≤ Events 2::End

AND

Events::End ≥ Events 2::Start

AND

Events::EventID ≠ Events 2::EventID

Share this post


Link to post
Share on other sites

In thinking about the method for comparing times, consider (search for) the events which start one day and end a day later. Then continue your script to compare (in a loop) all events in that set to events which occur during that following day.

Share this post


Link to post
Share on other sites

No, do what Comment says, in both using the time stamp AND using the multi-predicate relationship to do the heavy lifting.

A "time" by itself is practically* useless for anything. Hence "timestamp" was invented.

* Yes, yes, there are many practical uses for Time fields. This isn't one of them.

Share this post


Link to post
Share on other sites

Thanks very much. I agree with the relationship stance, and this is what was driving me a bit nuts. I thought about timestamp but wasn't sure how best to use it. I do not want to script this, so I think Comment's comments (he he) are valid here.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.