feat/instructor-course-authoring#98
Merged
Merged
Conversation
The instructor area under /instructor/courses (already role-gated) lets an instructor create and edit their courses and lessons, publish, archive, and restore them, and reorder lessons. InstructorCourseService owns the write side: ownership is enforced at the service level (someone else's course answers 403), lifecycle transitions follow CONTRIBUTING.md (publish from DRAFT, archive from DRAFT or PUBLISHED, restore to DRAFT, anything else 409), and published_at is stamped on the first publish only. Publish, archive, and restore actions are recorded through AuditService with the client IP, like the password-reset flow. Lessons append at position max plus one, and reordering swaps with the neighbor through a temporary negative position because uq_lessons_course_position is not deferrable (proven against real Postgres in the repository test). Forms reuse the register.html error wiring (aria-invalid, aria-describedby, alert summary); the security matrix tightens the instructor gate to 200 with a seeded user.
The course editor links to a roster page listing every enrollment of the course (username, status, enrollment and drop dates) in an accessible data table. The instructor can remove an actively enrolled student: this reuses the student-side drop rules (idempotent, COMPLETED untouched) and is audited as ENROLLMENT_DROPPED_BY_INSTRUCTOR, distinct from a self-drop. InstructorCourseFlowTest drives the whole instructor journey end to end: create with a validation error on the way, add and reorder lessons, publish lesson and course, watch the student catalogue pick the course up, get a 409 on a double publish and a 403 as another instructor, list the roster, drop the student, and check the audit trail and that drafts stay invisible.
Both glossaries gain the two domain terms the instructor area introduces, EN and FR kept in sync per the glossary rule: Publish (make a draft visible to students; the first publication stamps published_at) and Roster (the enrolled students of a course, which instructors can remove a student from). Archive was already defined.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dev #98 +/- ##
============================================
- Coverage 82.96% 76.90% -6.06%
- Complexity 97 141 +44
============================================
Files 27 31 +4
Lines 364 576 +212
Branches 25 36 +11
============================================
+ Hits 302 443 +141
- Misses 40 106 +66
- Partials 22 27 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR:
PublishandRoster.Details
InstructorCourseServiceenforces ownership and lifecycle transitions:-
DRAFT=>PUBLISHED,- archive from
DRAFT/PUBLISHED,- restore =>
DRAFT)Lesson handling:
aria-invalid,-aria-describedby, alert summary).username,status, enrollment/drop datesENROLLMENT_DROPPED_BY_INSTRUCTOR.AuditServicerecords publish/archive/restore actions with client IPInstructorCourseFlowTestcovers:- create/edit/validation lesson
- add/reorder/publish,
- course publish and access control roster listing and drop,
- audit checks.
Glossary updated (EN/FR) for "Publish" and "Roster".