Package: course-variants
Generated from api/packages/course-variants
Source: api/packages/course-variants. The sections after the README are extracted from the code on every docs build.
README
Section titled “README”The LMS side of course variants (ADR 0192, Phase 4.4 of docs/ROADMAP-PROMPT.md). A family groups the LMS
courses that are variants of one course: a default course (the base) and one member course per audience (a level, a
role or both). The package knows nothing about the Course Builder: the builder registers a variant’s course here when
it applies the variant, and a family can in future be made by hand.
- Plan:
docs/plans/course-versions-and-variants.md(section 6.2). Guide:front/docs-site/src/content/docs/creators/course-versions-and-variants.mdx. - Tables:
course_variant_groups(default_course_id) andcourse_variant_group_members(course_id,variant_key,label,level,role,position). - A member course is hidden from the public catalogue (
findableis switched off through the courses repository), so the family shows once, as its default course. Learners reach a variant through the family (routing is milestone CV-5).
Learner routing (CV-5)
Section titled “Learner routing (CV-5)”Guide: front/docs-site/src/content/docs/developers/course-variants-api.mdx. Tables added: course_variant_assignments (one current
row per learner and family, history kept), course_variant_rules, course_variant_placement_items and _attempts, course_variant_hints;
the family gets pinned_course_id, lock_assigned, placement_enabled, hints_enabled and how its default course is named in the picker.
AssignmentService: the learner’s own choice (self,placement,hint) or an admin’s or rule’s assignment. Choosing needs access to the family; an admin’s assignment grants it. It supersedes the old row, enrols through the family entitlement and carries progress over.FamilyAccess: one entitlement covers the family. A learner with an entitlement (or a group) for any course of it gets a derivedfamilyentitlement for the variant they use (EntitlementService::syncDerived), kept in step by a listener onAccessProjected: it ends with the entitlements it derives from and follows their end date.ProgressCarryOver: completion moves to the new course for topics theTopicCorrespondencecontract says are the same content (the Course Builder implements it from its entity map; quiz topics are never paired), through the coursesProgressService.PlacementService: optional, advisory, scored by code. Questions come from thePlacementSourcecontract (the builder: cited quiz questions that already exist).HintService: at most one hint per learner and family per week, dismissing stops them; the rules are theFitSignalscontract (Learner Insights).RuleAssigner: attribute rules through the compliance rule engine, only for learners who already have access.- Catalogue: variant courses stay
findable = false; their page is open throughCourseVisibility, and the default course’s card carriesvariant_family. - Endpoints:
api/courses/{course}/variants(public),variant,placement(learner),api/admin/course-variant-groups(permissioncourse_variants_assign). Command:course-variants:assign-by-rules(daily).
Install: registered by the Course Builder provider and in api/config/app.php; run the migrations. Tests:
php artisan test --testsuite course-variants.
API endpoints
Section titled “API endpoints”| Method | Path | Auth | Action |
|---|---|---|---|
GET |
/api/courses/{course}/variants |
VariantController@variants |
|
GET |
/api/courses/{course}/variant |
yes | VariantController@show |
PUT |
/api/courses/{course}/variant |
yes | VariantController@choose |
POST |
/api/courses/{course}/variant/hints/{hint}/dismiss |
yes | VariantController@dismissHint |
GET |
/api/courses/{course}/placement |
yes | PlacementController@show |
POST |
/api/courses/{course}/placement/attempts |
yes | PlacementController@attempt |
GET |
/api/admin/course-variant-groups |
yes | GroupAdminController@index |
GET |
/api/admin/course-variant-groups/{group} |
yes | GroupAdminController@show |
PUT |
/api/admin/course-variant-groups/{group} |
yes | GroupAdminController@update |
GET |
/api/admin/course-variant-groups/{group}/assignments |
yes | GroupAdminController@assignments |
PUT |
/api/admin/course-variant-groups/{group}/assignments |
yes | GroupAdminController@assign |
GET |
/api/admin/course-variant-groups/{group}/placement |
yes | GroupAdminController@placementShow |
POST |
/api/admin/course-variant-groups/{group}/placement/rebuild |
yes | GroupAdminController@placementRebuild |
GET |
/api/admin/course-variant-groups/{group}/rules |
yes | RuleAdminController@index |
POST |
/api/admin/course-variant-groups/{group}/rules |
yes | RuleAdminController@store |
PUT |
/api/admin/course-variant-groups/{group}/rules/{rule} |
yes | RuleAdminController@update |
DELETE |
/api/admin/course-variant-groups/{group}/rules/{rule} |
yes | RuleAdminController@destroy |
POST |
/api/admin/course-variant-groups/{group}/rules/{rule}/evaluate |
yes | RuleAdminController@evaluate |
Permissions
Section titled “Permissions”| Permission | Seeded for roles | Constant |
|---|---|---|
course_variants_assign |
CourseVariantsPermissionsEnum::ASSIGN |
Settings
Section titled “Settings”Registered with AdministrableConfig::registerConfig (editable in the admin panel under Configuration → Settings).
None.
Events
Section titled “Events”| Event | Description | Notification templates |
|---|---|---|
VariantChosen |
A learner is now in a variant (first choice or a switch). Ids and the source only; no learner data beyond the id. |
Artisan commands
Section titled “Artisan commands”| Command | Description | Signature |
|---|---|---|
course-variants:assign-by-rules |
Put learners without a variant into the variant an active assignment rule gives them | course-variants:assign-by-rules |
Scheduled jobs
Section titled “Scheduled jobs”| Kind | Target | Frequency |
|---|---|---|
| command | 'course-variants:assign-by-rules' |
dailyAt('06:30')->withoutOverlapping()) |
Environment variables read
Section titled “Environment variables read”None.