Shared Lesson Conflict: Redirection to Newest Course

Created on 20 September 2024, about 2 months ago

Problem/Motivation

It has been identified that when two courses share the same lesson, the lesson ID of the most recently registered course prevails. As a result, when accessing either of the courses and clicking on the shared lesson, the user is always redirected to the lesson in the most recently updated course, causing incorrect behavior in cases where lessons are shared between courses.

Steps to reproduce

1. Create two courses in the system.
2. Add the same shared lesson to both courses.
3. Try accessing the lesson in both courses.
4. Notice that when you access the lesson in either course, the user is redirected to the lesson from the most recently registered course.

Proposed resolution

The issue was identified in the file `docroot/modules/contrib/anu_lms/src/Lesson.php`, within the `getLessonModule()` method. The proposed solution is to adjust the logic to allow more than one `$module_ids` to be associated, preventing only the most recently registered course ID from prevailing.

Remaining tasks

- Adjust the code in the `getLessonModule()` method to support multiple `$module_ids`.
- Test the solution to ensure that shared lessons between courses correctly redirect to the appropriate course.
- Update documentation if needed.

User interface changes

No user interface changes are required.

API changes

No API changes are required.

Data model changes

No data model changes are required.

🐛 Bug report
Status

Active

Version

2.10

Component

Code

Created by

🇧🇷Brazil bladellano

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @bladellano
  • 🇰🇬Kyrgyzstan elaman

    Issue seems to be the fact that when you visit a lesson page (i.e. /node/123). The lesson has no way to know which course it is, if it is used in two or more courses.

    Reason for this is that relationship between course and lesson. If you take a course, you can determine what modules it contains, then what lessons each module contains. If you take a lesson, you can determine which modules it is in, then what course it is associated with, but there is no way of knowing which course exactly.

Production build 0.71.5 2024