Quiz is attached to Lesson (one-to-one), not a standalone entity
Quizzes are attached to Lessons via a one-to-one relationship. A Lesson can have at most one Quiz. The Quiz model is not a separate content type — it's a property of a Lesson.
Considered Options
- Standalone Quiz: Quiz as a first-class content type with its own view, URL, and permissions. Could be shared across Lessons. More flexible but introduces another top-level concept in the domain.
- Quiz as Space content: A Quiz lives directly in a Space, independent of any Lesson. Closer to how Circle.so handles assessments. But every Quiz in this app currently lives inside a course context.
- Attached to Lesson (chosen): Quiz has a one-to-one FK to Lesson. The lesson detail page renders the quiz inline. QuizAttempt records are linked to the Lesson (via the Quiz → Lesson chain).
Why attached to Lesson was chosen
- Every real usage of quizzes in the app is tied to a lesson within a course. There are no standalone quizzes.
- The one-to-one constraint enforces clarity: a lesson has either zero or one quiz. No ambiguity about which quiz belongs to which lesson.
- LessonProgress and QuizAttempt are complementary: completing a lesson's quiz marks the lesson as completed, and the pass/fail result is recorded directly on the quiz attempt.
Consequences
- If standalone quizzes are ever needed, the O2O must become an FK, and quiz management needs its own views/URLs.
- QuizAttempt is idempotent per member per quiz: re-taking updates the existing attempt rather than creating a new one. This is by design — quiz history is not tracked across attempts.