Cancellation cutoff: limit how close to a lesson a student can cancel #93

Closed
opened 2026-07-23 14:36:19 +00:00 by thatguygriff · 0 comments
Owner

Summary

Add a cancellation cutoff so a student can no longer cancel a lesson once it is
too close to its start time. Instructors and studio admins can always cancel,
regardless of the cutoff.

Studio default setting

  • A studio-wide default cutoff, configured under Studio Settings.
  • Stored and computed in hours, but always displayed to the admin in days
    ("Students can cancel up to N days before a lesson").
  • Sensible default: 1 day (24 hours).

Per-offering override

  • Each offering may set its own cutoff (a time, in hours).
  • When an offering's cutoff is not set, it falls back to the studio default.

Enforcement

  • Student-initiated cancellation (POST /bookings/{id}/cancel) is rejected when
    now is within the effective cutoff of the slot's start time, returning a clear
    message explaining how far in advance cancellations must happen.
  • Instructor status changes (PATCH /bookings/{id}/status) and studio-admin
    student actions are unaffected — they can cancel at any time.

Data model

  • New nullable column cancellation_cutoff_hours on {prefix}us_offerings.
  • New option us_cancellation_cutoff_hours (integer hours) for the studio default.
  • Schema change → bump USC_VERSION and the plugin header.

Tests

  • composer test, composer lint, composer cs must all pass.
## Summary Add a cancellation cutoff so a student can no longer cancel a lesson once it is too close to its start time. Instructors and studio admins can **always** cancel, regardless of the cutoff. ## Studio default setting - A studio-wide default cutoff, configured under **Studio Settings**. - **Stored and computed in hours**, but **always displayed to the admin in days** ("Students can cancel up to N days before a lesson"). - Sensible default: 1 day (24 hours). ## Per-offering override - Each offering may set its own cutoff (a time, in hours). - When an offering's cutoff is **not set**, it falls back to the studio default. ## Enforcement - Student-initiated cancellation (`POST /bookings/{id}/cancel`) is rejected when `now` is within the effective cutoff of the slot's start time, returning a clear message explaining how far in advance cancellations must happen. - Instructor status changes (`PATCH /bookings/{id}/status`) and studio-admin student actions are unaffected — they can cancel at any time. ## Data model - New nullable column `cancellation_cutoff_hours` on `{prefix}us_offerings`. - New option `us_cancellation_cutoff_hours` (integer hours) for the studio default. - Schema change → bump `USC_VERSION` and the plugin header. ## Tests - `composer test`, `composer lint`, `composer cs` must all pass.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Unsupervised/unsupervised-scheduler#93