Problem
A course certificate is auto-generated the moment lesson progress hits 100% — with no check that the course's assignments were submitted or graded.
In src/pages/api/lms/progress/index.ts, completion is computed purely from lessons:
progressPercentage = round(completedLessons / totalLessons * 100)
isComplete = progressPercentage === 100
// → on transition to COMPLETED, generate certificate number, render PDF,
// upload, create Certificate row, email the user
Assignments (Assignment / Submission models) are never consulted. A veteran can mark every lesson complete, submit zero assignments, and still receive a verifiable VWC certificate.
Why it matters
For a software engineering accelerator, the certificate should attest to demonstrated, graded work — not just content consumption. Issuing it on lesson-views-only weakens the credential and the verification feature (see related cert-verification bug). It also undercuts the assignment → submission → grading loop that already exists (src/pages/api/lms/submissions/**, .../[submissionId]/grade.ts).
Decision to make
Define real completion criteria. Options:
- Require all required assignments to be
GRADED (and optionally meeting a minimum score) before a course is COMPLETED and a certificate issues.
- Mark some assignments
required vs optional (add a flag to Assignment if not present) so completion gates on required ones only.
- Keep lesson progress for the progress bar, but gate
COMPLETED/certificate on assignments.
Proposed implementation
- In
src/pages/api/lms/progress/index.ts, before setting COMPLETED/issuing a cert, query the course's required assignments and the user's submissions; only complete when all required submissions exist and are GRADED (and ≥ passing score, if defined).
- Surface remaining requirements to the learner ("2 assignments left to graduate this course").
- Add tests for: lessons-100%-but-assignments-pending → not completed, no cert; all requirements met → completed + cert.
Acceptance criteria
- Certificate cannot be issued for a course with ungraded/missing required assignments.
- Learner can see what remains before completion.
- Tests cover both paths.
Problem
A course certificate is auto-generated the moment lesson progress hits 100% — with no check that the course's assignments were submitted or graded.
In
src/pages/api/lms/progress/index.ts, completion is computed purely from lessons:Assignments (
Assignment/Submissionmodels) are never consulted. A veteran can mark every lesson complete, submit zero assignments, and still receive a verifiable VWC certificate.Why it matters
For a software engineering accelerator, the certificate should attest to demonstrated, graded work — not just content consumption. Issuing it on lesson-views-only weakens the credential and the verification feature (see related cert-verification bug). It also undercuts the assignment → submission → grading loop that already exists (
src/pages/api/lms/submissions/**,.../[submissionId]/grade.ts).Decision to make
Define real completion criteria. Options:
GRADED(and optionally meeting a minimum score) before a course isCOMPLETEDand a certificate issues.requiredvs optional (add a flag toAssignmentif not present) so completion gates on required ones only.COMPLETED/certificate on assignments.Proposed implementation
src/pages/api/lms/progress/index.ts, before settingCOMPLETED/issuing a cert, query the course's required assignments and the user's submissions; only complete when all required submissions exist and areGRADED(and ≥ passing score, if defined).Acceptance criteria