Describe the bug
There is a bug in the appointment scheduling system that allows conflicts in dates, times and nutritionists to occur.
To Reproduce
Steps to reproduce the behavior:
Go to appointments page.
Select a date, time and nutritionist
Repeat the steps 2 and 3, choosing the same date, time and nutritionist as an existing appointment.
Expected behavior
The system should prevent the scheduling of conflicting appointments, ensuring that the selected date, time and nutritionist do not overlap with existing appointments.
Screenshots
N/A
Desktop (please complete the following information):
OS: Windows 10
Browser: Google Chrome
Smartphone (please complete the following information):
Device: iPhone 12
OS: iOS 14.7.1
Browser: Safari
Version: 14.1
Additional context
The conflict in dates, times and nutritionist compromises the appointment system and can lead to double-bookings or overlapping appointments.
To resolve the issue, I create a clean() method in the appointment form, that retrieve the selected date, time and nutritionist.
I query the database for any existing appointments that have the same date, time, and nutritionist combination, excluding the current appointment being edited.
If any conflicts are found, will raise a 'forms.ValidationError' with an appropriate error message, indicating the conflict.
Describe the bug There is a bug in the appointment scheduling system that allows conflicts in dates, times and nutritionists to occur.
To Reproduce Steps to reproduce the behavior:
Expected behavior The system should prevent the scheduling of conflicting appointments, ensuring that the selected date, time and nutritionist do not overlap with existing appointments.
Screenshots N/A
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context The conflict in dates, times and nutritionist compromises the appointment system and can lead to double-bookings or overlapping appointments.