Answer the question
In order to leave comments, you need to log in
Electronic queue (schedule) on the site. How to make periodicity?
Greetings!
The task in general terms: A
calendar with the possibility of booking services for certain hours.
The difficulty was caused by the Periodicity option; the client can book not a one-time provision of services, but booking them for performance one, two, three or four times a month. Accordingly, all these days (hours) should not be available for selection by other customers.
Let's just say that if the booking is made once a week, then you can check the availability of the day in the calendar with almost one request
SELECT * FROM ORDERS WHERE REPEAT LIKE '1 week' AND WEEKDAY(`date`)+1 = '{$weekday}'
Answer the question
In order to leave comments, you need to log in
There cannot be more than one reservation for one hour, otherwise they will overlap, no matter how often the reservation is. Therefore, you can store what reservation is for each hour, and check that it does not overlap with the request. To store a reservation, it is enough to know the start date and frequency. It takes a day if the difference between the request and the start of the reservation is divided by the frequency
As well as for any time-limited resource. Data with periodic reservations blocks the resource for the period for which the reservation is set for each timeslot in the period. See how the calendar in the smartphone is implemented.
There should be two entities - booking and time slot.
The reservation must have a sign of periodicity and its settings.
The time slot must have a link to the booking, empty or busy.
Timeslots must be pre-created for the future within which bookings can be made.
When you create a booking, all time slots that match the schedule are given a link to the booking.
When canceling a booking. resp. links are removed.
When creating a booking, it is important to look at the possibility of taking the necessary time slots and somehow handle the situation when at least one time slot cannot be occupied in accordance with the schedule.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question