Skip to content

Course evaluation#110

Merged
swilla merged 28 commits into
4.xfrom
course_evaluation
Jul 7, 2026
Merged

Course evaluation#110
swilla merged 28 commits into
4.xfrom
course_evaluation

Conversation

@andreia

@andreia andreia commented Jul 3, 2026

Copy link
Copy Markdown
Member

Details

Schema

  • evaluation_course_id on lms_courses — links a training course to its evaluation course

Completion flow

  • Primary course completed_at and certificate wait until evaluation is done
  • Auto-assigns evaluation course when primary training steps are complete
  • Redirects to evaluation after last primary step
  • CourseCompleted page shows “Complete Evaluation” when pending
  • Access gating blocks evaluation steps until primary is complete

Config (filament-lms.evaluations.enabled) — opt-in feature flag

Complete instructions added on README file.


Note

High Risk
Changes core completion, certificate eligibility, and step progress scoping across Course/Step/Livewire pages; misconfiguration or shared-evaluation edge cases could block certificates or show wrong progress.

Overview
Adds an opt-in course evaluation flow (filament-lms.evaluations.enabled) where a training course links to a separate private evaluation course via evaluation_course_id. Learners must finish that linked form course before the primary course gets completed_at, a certificate, or the normal completion UI.

Schema & admin: New migrations add evaluation_course_id on courses, plus evaluation_primary_course_id and filament_form_user_id on lms_step_user so one shared evaluation course can track per-training progress and form submissions. Admin Course resource gets an Evaluation course select with validation (private targets only, no reverse/nested links). README documents setup; tapp/filament-form-builder is bumped to ^4.3.5.

Completion & UX: New CourseEvaluationService centralizes gating, auto-enrollment, URLs with primaryCourse query param, and finalizing primary completion after evaluation. maybeSetCompletedAtForUser defers primary completion until evaluation passes (and still respects test score rules). Course completed page shows Complete Evaluation when pending and View Evaluation after submit; evaluation-only courses are hidden from the dashboard listing. Step / FormStep / embedded SCORM exit paths redirect into evaluation; evaluation form steps hide Next, allow resubmissions, and tie submissions to the scoped StepUser row.

Reviewed by Cursor Bugbot for commit 1082a51. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread src/Pages/CourseCompleted.php
Comment thread src/Resources/CourseResource.php
Comment thread src/Pages/CourseCompleted.php
Comment thread tests/TestCase.php
Comment thread src/Models/Course.php
Comment thread src/Livewire/FormStep.php Outdated
Comment thread src/Resources/CourseResource.php
Comment thread src/Services/CourseEvaluationService.php Outdated
Comment thread src/Services/CourseEvaluationService.php
Comment thread resources/views/livewire/form-step.blade.php Outdated
Comment thread src/Models/Course.php
Comment thread src/Pages/Step.php
Comment thread src/Models/Step.php
Comment thread src/Models/Step.php
Comment thread src/Services/CourseEvaluationService.php
Comment thread src/Traits/FilamentLmsUser.php
Comment thread resources/views/pages/step.blade.php
Comment thread src/Services/CourseEvaluationService.php Outdated
Comment thread src/Services/CourseEvaluationService.php Outdated
@andreia andreia requested a review from swilla July 4, 2026 02:01

@swilla swilla left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a way for this to work with a scorm course since the menu is hidden for those.

andreia and others added 2 commits July 6, 2026 17:14
- Widen embeddedCourseExitUrl()'s parameter to Authenticatable&FilamentLmsUserInterface so $user->id resolves under PHPStan
- Scope video/test step completions to the active evaluation primary course, matching form steps
- Guard evaluationPrimaryCourseIdFromRequest() against untrusted query params when the route's course can't be verified
- Remove an evaluationStepAvailableForPrimary() check that let mislinked evaluation courses skip step ordering
Comment thread src/Models/Step.php
Step page mount() resolves an implicit primaryCourse via
activePrimaryCourseForEvaluation() when it's absent from the query string,
but progress lookups, completion percentage, and navigation links all read
evaluationPrimaryCourseIdFromRequest() directly, which only sees an explicit
query param. That mismatch left a step's own progress reading unscoped rows
right after completing it under the resolved primary course.

Write the resolved id back into the request's query bag once mount() settles
on it, so every other consumer within the same request sees the same scope.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1082a51. Configure here.

Comment thread src/Models/Step.php
return $this->hasOne(StepUser::class)->ofMany([
// TODO is this started_at => max needed?
'created_at' => 'max',
], function ($query) use ($currentUserId) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Video progress ignores evaluation scope

Medium Severity

videoProgress still reads and writes lms_step_user rows without evaluation_primary_course_id, while evaluation progress and completion use primary-scoped rows. On a shared evaluation course with a video step, progress and completion can attach to the wrong pivot row and never satisfy scoped completion checks.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 1082a51. Configure here.

@swilla swilla merged commit ec87ef4 into 4.x Jul 7, 2026
16 checks passed
@swilla swilla deleted the course_evaluation branch July 7, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants