Enhance progress tracking to determine pre/post test quiz version
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
When a learner starts a pre-test or post-test within a course session, the progress tracking system needs to determine which quiz version (A or B) they receive, and provide a synthetic content_id for the logging models to track progress against. The A/B split must be deterministic for a given course session so that synced devices always agree, and the synthetic content_ids must be unique per pre-test and post-test but also deterministic. This follows the same pattern as quiz_id for coach-created quizzes.
Complexity: High
Context
The progress tracking API was enhanced in #14105 to accept course session context. The UnitTestAssignment model from #14099 defines the two quiz versions (A and B) available for each unit's pre/post tests. This issue further extends progress tracking to handle the full lifecycle of pre/post test attempt tracking.
The Change
The _get_context method in ProgressTrackingViewSet needs a new branch for pre/post tests, alongside the existing node_id and quiz_id branches. When a unit_id and pre/post indicator are provided in combination with the existing course_session_id parameter:
- Compute a deterministic hash from (learner_id, course_session_id, unit_id). The last digit of the hash determines the A/B split: even means pre-test gets version A and post-test gets version B; odd means the reverse.
- Construct a mastery_model using the
PRE_POST_TESTtype from le-utils, including the A/B version and pre/post test type:mastery_model = { "type": exercises.PRE_POST_TEST, "version": "A", # or "B" "test_type": "pre", # or "post" } - Generate a synthetic content_id as a UUID5 incorporating the deterministic hash plus the pre/post indicator, so pre-test and post-test each get a unique but reproducible identifier
- Set
channel_id = Noneandkind = content_kinds.QUIZ, following the coach quiz pattern - Store
unit_idin the context alongside the existingcourse_session_id. The A/B version and test type live exclusively in the mastery_model, not in the context.
The StartSessionSerializer needs validation for the new parameter combination, and _start_assessment_session needs to handle the PRE_POST_TEST mastery type.
Acceptance Criteria
- [ ] Progress tracking API accepts a new entry path with unit_id and pre/post indicator, in combination with the existing course_session_id parameter
- [ ]
_get_contexthas a new branch that constructs a mastery_model withtype: exercises.PRE_POST_TEST,version(A or B), andtest_type(pre or post) - [ ] A deterministic hash of (learner_id, course_session_id, unit_id) is used to determine the A/B split: last digit even = pre-test A / post-test B, odd = reverse
- [ ] A/B determination is stable — same inputs always produce the same version assignment
- [ ] A synthetic content_id is generated as a UUID5 incorporating the deterministic hash plus the pre/post indicator
- [ ] Pre-test and post-test synthetic content_ids for the same unit are always distinct
- [ ] The synthetic content_id is used on logging models (ContentSessionLog, ContentSummaryLog, MasteryLog) following the existing quiz_id pattern —
channel_id = None,kind = content_kinds.QUIZ - [ ] A/B version and test type are stored exclusively in the mastery_model, not in the context
- [ ] Unit_id is stored in the context alongside course_session_id
- [ ] The mastery_model is returned in the response as mastery_criterion, along with attempt history
- [ ] Re-initiating a session for a test already started resumes the existing mastery log via the same synthetic content_id
- [ ] Validation rejects requests missing course_session_id
Testing
- [ ] Unit tests verify even/odd hash logic produces consistent A/B results
- [ ] Unit tests verify synthetic content_id stability (same inputs → same UUID5) and distinctness (pre vs post differ)
- [ ] Unit tests verify session resumption finds existing mastery log records
🤖 This issue was written with AI assistance, under supervision, review and final edits by [@rtibbles] 🤖
Hi @rtibbles (and maintainers),
Thanks for the detailed description - it’s very clear and helpful. I’ve gone through the context, acceptance criteria, and the referenced PRs, and I’d love to contribute to this issue. I’d be happy to take this on. Please let me know if you’d like me to proceed or if there are any adjustments you’d recommend before I start.
Thanks!
Hi! 👋
Thanks so much for your interest! This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues. If there are no unassigned 'help wanted' issues available, please wait until new ones are added.
We really appreciate your willingness to help. 😊
Are you preparing for Google Summer of Code? See our GSoC guidelines.
Fixed in #14316