feat(courses): add quiz/assessment system - #385
Merged
zeemscript merged 2 commits intoSep 3, 2026
Conversation
Implements Deen-Bridge#189: course quizzes with MCQ questions, server-side scoring, pass/fail thresholds, attempt history, and lesson completion on passing. Adds: - Quiz and QuizAttempt Mongoose models with repositories - QuizService (create/update/delete/attempt scoring/results) - REST controllers + routes mounted at /api/quiz* (management restricted to verified educators/admins; attempts for authenticated learners) - 11 acceptance tests (scoring spoof-proofing, pass->lesson completion, learner/owner authorization, attempt history) Also includes minimal base boot fixes required for CI (npm test) to pass on the broken upstream/main import graph: migrated missing user preferences runtime modules (preferences.js, UserPreferences.js, preferences.socket.js) from the unwired .ts stubs.
|
@datboilondon Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- coreFlows.test.js: the spawnSync app-import child never exited because importing app.js starts job schedulers that keep the process alive, deadlocking the suite indefinitely. Have the child self-terminate after the import resolves (exit 0) or on error (exit 1). - certificate.test.js: correct stale assertion; the certificate service generates 'cert_'-prefixed ids, not 'CERT-'. These are pre-existing issues in the base suite (unrelated to the quiz feature) that were unmasked by the boot fix and prevented the CI Run Tests job from reaching a conclusion.
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.
Closes #189
Summary
Adds a quiz/assessment system for courses. Educators can create/edit/delete quizzes composed of multiple-choice questions with a pass/fail score threshold. Learners can attempt a quiz, get server-side scored results, view their attempt history, and automatically complete the associated lesson when they pass.
What was added
src/models/quiz.model.js- Quiz schema (course ref, optional lesson, passingScoreThreshold default 60, questions with prompt/options/correctOptionIndex)src/models/quiz-attempt.model.js- QuizAttempt schema (answers, server-scored percentage, passed, submittedAt)mongo/repositories/QuizRepository.js/QuizAttemptRepository.js- BaseRepository-backed data accesssrc/services/quiz.service.js- create/update/delete, learner-facing view (correct answers stripped pre-submission), spoof-proof server-side scoring, pass->lesson completion, attempt history/resultssrc/controllers/quiz.controller.js+src/routes/courses/quizRoutes.js- REST API mounted at /api/quiz*test/quiz.test.js- 11 acceptance testsAcceptance criteria mapping
Test results
CERT-vs servicecert_; coreFlows payment-chain suite hanging on local external-service deps).Notes
Includes a minimal base boot fix (migrated missing user-preferences runtime modules from unwired .ts stubs) that is required for CI (
npm test) to boot the app at all on upstream/main.