Show enrolment status on the student group classes page #62

Merged
thatguygriff merged 1 commits from feature/enrolled-status into main 2026-07-06 02:44:20 +00:00
Owner

Closes #61

What

On the student group classes page, a class the student already has an active enrolment in now shows "You are enrolled in this class." instead of the Enrol button — in both the browse-all catalog and the single-class embed mode ([us_group_classes offering="…"]).

How

loadClasses() in assets/js/group-classes.js fetches offerings?kind=group_class and enrollments in parallel and passes the set of actively-enrolled offering ids into the renderer. Only status === 'active' counts — a cancelled enrolment does not block re-enrolling, matching the server-side duplicate rule (hasActiveEnrollment / 409 already_enrolled), which remains the enforcement layer; this is a UX improvement over the previous flow where the student completed the whole questions/policies form before hitting the 409.

No PHP changes: GET /enrollments already returns the caller's own enrolments with offering_id and status, and the page is login-gated.

Testing

composer test (308 tests), composer lint, composer cs all pass (PHP untouched). JS-only change with no JS harness in the repo — review-verified; worth a click-through with an enrolled student account.

🤖 Generated with Claude Code

Closes #61 ## What On the student group classes page, a class the student already has an **active** enrolment in now shows "You are enrolled in this class." instead of the Enrol button — in both the browse-all catalog and the single-class embed mode (`[us_group_classes offering="…"]`). ## How `loadClasses()` in `assets/js/group-classes.js` fetches `offerings?kind=group_class` and `enrollments` in parallel and passes the set of actively-enrolled offering ids into the renderer. Only `status === 'active'` counts — a cancelled enrolment does not block re-enrolling, matching the server-side duplicate rule (`hasActiveEnrollment` / `409 already_enrolled`), which remains the enforcement layer; this is a UX improvement over the previous flow where the student completed the whole questions/policies form before hitting the 409. No PHP changes: `GET /enrollments` already returns the caller's own enrolments with `offering_id` and `status`, and the page is login-gated. ## Testing `composer test` (308 tests), `composer lint`, `composer cs` all pass (PHP untouched). JS-only change with no JS harness in the repo — review-verified; worth a click-through with an enrolled student account. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
thatguygriff added 1 commit 2026-07-06 02:41:18 +00:00
Show enrolment status on the student group classes page
CI / Tests (PHP 8.2) (pull_request) Successful in 48s
CI / Tests (PHP 8.1) (pull_request) Successful in 49s
CI / No Debug Code (pull_request) Successful in 2s
CI / PHPStan (pull_request) Successful in 1m17s
CI / Tests (PHP 8.3) (pull_request) Successful in 37s
CI / Coding Standards (pull_request) Successful in 2m47s
CI / Build Plugin Zip (pull_request) Has been skipped
30b0112431
The class list now loads the student's own enrolments alongside the
catalog; a class they already have an active enrolment in shows "You
are enrolled in this class." instead of the Enrol button, in both the
browse-all catalog and the single-class embed mode. Previously the
button always rendered and a duplicate attempt walked the student
through the whole questions/policies flow before failing with 409
already_enrolled. A cancelled enrolment does not block re-enrolling,
matching the server-side duplicate rule.

Closes #61

Co-Authored-By: Claude Fable 5 <[email protected]>
thatguygriff merged commit e7d8257973 into main 2026-07-06 02:44:20 +00:00
thatguygriff deleted branch feature/enrolled-status 2026-07-06 02:44:20 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Unsupervised/unsupervised-scheduler#62