Closed (fixed)
Project:
Drupal LMS
Version:
1.1.x-dev
Component:
Courses and lessons
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Feb 2026 at 19:08 UTC
Updated:
26 Aug 2026 at 04:01 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
socketwench commentedThis patch adds further NULL checking for the method. From testing, passing 0 here on a free navigation course appears to work. I'm not sure if it's the appropriate fix or not.
Comment #3
graber commentedThat redirects to the first activity of the previous lesson instead of the last one. We need to initialize the lesson if the status is NULL instead. Can you update the solution and create a MR?
Should be something like:
We should probably also just return early in
LmsLessonHandlerBase::checkRequirements()if$course_status->getCourse()->hasFreeNavigation(). Would probably be nice to inform course creators that the lesson reference mandatory setting has no effect in free navigation mode..Comment #5
socketwench commentedChanged this to a try/catch with a fast return on the recommendation of Graber.
Also added a fast return for LMSLessonHandlerBase::checkRequirements in the case the course has free navigation.
Comment #6
graber commentedLeft some comments in the MR.
Comment #7
graber commentedComment #9
graber commentedComment #12
lv46gl commentedDear Graber!
Solution #3 is good, but after setting the value of $previous_lesson_status, $deltas['activity'] will not be calculated, so we get an error at the end of the method:
Warning: Undefined array key "activity" message in Drupal\lms\TrainingManager->getBackNavDeltas()The function currently looks like this:
Perhaps it should be more like this:
Comment #13
leeksoup commentedI am getting this error as well.
#12 suggests adding
$deltas['activity'] = 0;
right below the try / catch.
Is the right or reasonable fix?