Demo follow-ups: editable policy name, one-page signup, group classes in upcoming lessons, deletion cleanup
CI / Tests (PHP 8.1) (pull_request) Successful in 1m0s
CI / Tests (PHP 8.2) (pull_request) Successful in 1m0s
CI / No Debug Code (pull_request) Successful in 3s
CI / Coding Standards (pull_request) Successful in 3m8s
CI / Build Plugin Zip (pull_request) Skipped
CI / PHPStan (pull_request) Successful in 2m49s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m44s
CI / Tests (PHP 8.1) (pull_request) Successful in 1m0s
CI / Tests (PHP 8.2) (pull_request) Successful in 1m0s
CI / No Debug Code (pull_request) Successful in 3s
CI / Coding Standards (pull_request) Successful in 3m8s
CI / Build Plugin Zip (pull_request) Skipped
CI / PHPStan (pull_request) Successful in 2m49s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m44s
Five items from the latest demo pass: - A policy's title can be edited from the Policies screen. Only the title moves; the slug is what the gates resolve policies by, so a rename can never detach a policy from acceptances already recorded against it. - Signup is one page again. The studio's registration questions move from a second step behind "Next" onto the main form, in an "About you" panel above the students being added, and that panel also asks an adult student for their birth year (the same us_birth_year meta a child's uses). register.js disables and hides the whole panel for a pure guardian, since the questions describe a student. - The password is re-scored on submit, not only as it is typed. zxcvbn's dictionary arrives after page load, so a password typed straight away was never scored at all and the first the student heard of it was the server rejecting the whole form. - Group-class sessions appear alongside lessons wherever upcoming lessons are listed: the [us_scheduler] panel (students and instructors) and the admin student detail page. GroupClass\SessionSchedule derives them from Offering::sessionWindows(), the same derivation the billing scan uses. They carry kind = 'group_class' and no Cancel action - a session is one date in a term, not a booked slot. - Deleting a user releases what the account was holding: each upcoming lesson is cancelled, its slot freed for rebooking, its pending payment voided, and active class enrolments cancelled. Past lessons and paid history are left alone. Tests: composer test (851), composer lint, composer cs all pass. Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
@@ -27,6 +27,10 @@ No new tables. The views are composed from existing data:
|
||||
- **Account** — display name, email, registered date.
|
||||
- **Upcoming lessons** and **Past lessons** — split by the linked availability
|
||||
slot's `start_dt`; each shows date/time, offering, instructor, and status.
|
||||
**Upcoming lessons** also lists the student's upcoming group-class sessions
|
||||
(`GroupClass\SessionSchedule`, marked "group class"), so one table answers
|
||||
"what are they booked into next week?". Only upcoming ones: past dates would
|
||||
bury the lessons, and the enrolment table below already holds the history.
|
||||
- **Group-class enrolments** — active/past, with offering title and status.
|
||||
- **Policy acceptances** — every acceptance the student has recorded, newest
|
||||
first: policy title, version, context (account signup / lesson / enrolment),
|
||||
@@ -51,7 +55,25 @@ All actions are nonce-protected POSTs handled on the detail page:
|
||||
voided. A paid lesson is credited back to the student's account (see
|
||||
`credits.md`) rather than refunded.
|
||||
- **Withdraw** — on an active group-class enrolment: marked `cancelled` (freeing
|
||||
its capacity seat), with the same pending-payment voiding.
|
||||
its capacity seat), with the same pending-payment voiding. This is the only way
|
||||
to remove a class; the group-class rows in **Upcoming lessons** carry no Cancel
|
||||
action, because there is no such thing as cancelling one session of a term.
|
||||
|
||||
## Deleting a user
|
||||
Deleting a WordPress user is a core action that knows nothing about lessons, so
|
||||
`Auth\DeletedUserCleanup` hooks `delete_user` (and `wpmu_delete_user`) and gives
|
||||
back what the account was holding: every **upcoming** lesson is marked
|
||||
`cancelled`, its availability slot released for rebooking, and its still-pending
|
||||
payment voided; every **active** group-class enrolment is cancelled and its
|
||||
pending payment voided. Without it the slots stayed marked booked and unbookable
|
||||
by anyone else, the lessons stayed on the instructor's schedule under a name that
|
||||
no longer resolved, and a class kept a seat filled by nobody.
|
||||
|
||||
Past lessons are deliberately untouched: they happened, they may have been paid
|
||||
for, and the payment report has to keep adding up. No account credit is issued
|
||||
for a paid lesson either, unlike a cancellation the student asks for — a credit
|
||||
can only be spent on the account being deleted, so a refund owed to someone who
|
||||
has left is the studio's decision to make and record.
|
||||
|
||||
## Capabilities
|
||||
- `manage_students` — studio admin (administrators inherit it via the
|
||||
@@ -73,6 +95,8 @@ All actions are nonce-protected POSTs handled on the detail page:
|
||||
refuse records that don't belong to the student, and reuse
|
||||
`Payment\PaymentService::voidPending`) and account updates via
|
||||
`wp_update_user` (unit-tested with mocked repositories).
|
||||
- Group-class sessions in the upcoming table: `GroupClass\SessionSchedule::upcomingForStudent()`
|
||||
- Deletion cleanup: `Auth\DeletedUserCleanup` (hooked in `Plugin::boot()`)
|
||||
- Upcoming/past split: `Auth\StudentSchedule::partition()` (pure, unit-tested)
|
||||
- The upcoming/past split is extracted into a small pure helper so it is
|
||||
unit-testable (the controller itself follows the repo convention of not being
|
||||
@@ -80,6 +104,7 @@ All actions are nonce-protected POSTs handled on the detail page:
|
||||
|
||||
## Tests
|
||||
- `tests/Unit/Auth/StudentScheduleTest.php` (the pure upcoming/past split helper)
|
||||
- `tests/Unit/Auth/DeletedUserCleanupTest.php` (release on user deletion)
|
||||
- `tests/Unit/Auth/StudentHistoryTest.php` (history display rows + fallbacks)
|
||||
- `tests/Unit/Auth/StudentActionsTest.php` (cancel/withdraw guards + side
|
||||
effects, account validation)
|
||||
|
||||
Reference in New Issue
Block a user