kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Resume/redirect logic for course navigation

Open rtibbles opened this issue 10 months ago • 4 comments

❌ 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):

  1. If a pre-test or post-test is currently active → go to that test
  2. Otherwise → resume at first incomplete resource in the most recent unit with a completed pre-test
  3. 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_test is null if no test is currently active
  • resume_position is null if started is false
  • If active_test is 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:

  1. Call resume endpoint
  2. If started is false → redirect to welcome page
  3. If active_test is present → redirect to that test
  4. Otherwise → redirect to resume_position

Out of Scope

  • Viewing the content (follow-up task: ContentViewer integration)

Acceptance Criteria

  • [ ] Backend endpoint checks UnitTestAssignment for active tests
  • [ ] Backend endpoint returns active_test when a pre/post test is active
  • [ ] Backend endpoint returns resume_position (first incomplete resource in most recent unit with completed pre-test)
  • [ ] started is false when no unit has a completed pre-test
  • [ ] Frontend redirects to welcome page when started is false
  • [ ] Frontend redirects to active test when active_test is present
  • [ ] Frontend redirects to resume_position when 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] 🤖

rtibbles avatar Jan 15 '26 03:01 rtibbles

I would like to work on this issue. Kindly assign it to me.

avinxshKD avatar Jan 15 '26 13:01 avinxshKD

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.

learning-equality-bot avatar Jan 15 '26 13:01 learning-equality-bot

Fixed in #14128

rtibbles avatar Feb 10 '26 22:02 rtibbles

Fully fixed in #14145

rtibbles avatar Feb 19 '26 19:02 rtibbles