GiovaniFonseca / iHealthy

0 stars 1 forks source link

DEFECT: Conflicts in dates, times and nutritionist #39

Closed GiovaniFonseca closed 1 year ago

GiovaniFonseca commented 1 year ago

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:

  1. Go to appointments page.
  2. Select a date, time and nutritionist
  3. 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):

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.

GiovaniFonseca commented 1 year ago

Resolution Steps

  1. To resolve the issue, I create a clean() method in the appointment form, that retrieve the selected date, time and nutritionist.
  2. I query the database for any existing appointments that have the same date, time, and nutritionist combination, excluding the current appointment being edited.
  3. If any conflicts are found, will raise a 'forms.ValidationError' with an appropriate error message, indicating the conflict.