Resume/redirect logic for course navigation
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
Add resume/redirect logic for course navigation. Create a backend endpoint to determine the learner's resume position, and frontend logic to redirect when optional route params are missing.
Complexity: Medium
Context
The course route has optional unit/lesson/resource params. When these are missing, the frontend needs to redirect to the appropriate position.
Resume logic (unified for all learners):
- If a pre-test or post-test is currently active → go to that test
- Otherwise → resume at first incomplete resource in the most recent unit with a completed pre-test
- If course not started (no unit with completed pre-test) → welcome page
This uses UnitTestAssignment status from #14099 to determine which unit/test is active or completed.
The Change
Backend: New detail action on LearnerCourseViewset
Endpoint like /learnercourse/:id/resume/ that returns:
{
"started": true,
"active_test": {
"unit_id": "...",
"test_type": "pre"
},
"resume_position": {
"unit_id": "...",
"lesson_id": "...",
"resource_id": "..."
}
}
active_testis null if no test is currently activeresume_positionis null ifstartedis false- If
active_testis present, frontend should navigate to that test - Otherwise, navigate to
resume_position
Frontend: Redirect logic in CourseUnitView
When optional route params (unit/lesson/resource) are missing:
- Call resume endpoint
- If
startedis false → redirect to welcome page - If
active_testis present → redirect to that test - Otherwise → redirect to
resume_position
Out of Scope
- Viewing the content (follow-up task: ContentViewer integration)
Acceptance Criteria
- [ ] Backend endpoint checks
UnitTestAssignmentfor active tests - [ ] Backend endpoint returns
active_testwhen a pre/post test is active - [ ] Backend endpoint returns
resume_position(first incomplete resource in most recent unit with completed pre-test) - [ ]
startedis false when no unit has a completed pre-test - [ ] Frontend redirects to welcome page when
startedis false - [ ] Frontend redirects to active test when
active_testis present - [ ] Frontend redirects to
resume_positionwhen no active test - [ ] Unit tests for backend endpoint
- [ ] Unit tests for frontend redirect logic
🤖 This issue was written with AI assistance, under supervision, review and final edits by [@rtibbles] 🤖
I would like to work on this issue. Kindly assign it to me.
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 #14128
Fully fixed in #14145