As a doctor, I want to be able to reschedule an appointment for any given datetime. We always assume that the doc has already confirmed the new appointment time with their patient. Current restrictions not allowing free rescheduling should be bypassed as elegantly as possible. Execution starts @
ConsultationController->postReschedule()
After reviewing the business requirements of the "rescheduling by doctor" case, it's evident that it's indeed a special case with lots of differences in the handling logic (compared to a simple booking or patient rescheduling). This justifies some basic code refactoring to avoid adding code complexity or duplication.
-
Skip call to
isBookingDatetimeWithinAllowedThreshold()
to ignore the currently enforced minimum threshold of [now + 24 hours] on bookings/reschedulings. -
Skip call to
ConsultationAvailability::hasAvailableSlot()
. It doesn't matter if the rescheduled datetime falls within a predefined availability slot. All we care about is avoiding conflicts with existing bookings via thehasActiveBooking()
method. -
ConsultationAvailability::markAsBooked()
includes code which will produce an exception if the rescheduled time does not match an availability slot.