LMS H5P Course Activities Not Being Correctly Evaluated

Created on 18 June 2025, 10 days ago

Problem/Motivation

Courses are not marked completed after finishing H5P activities. After completing all activities (H5P) and click “Finish Course,” the system displays: “Course failed.”

The following PHP error appears in the logs:

TypeError: Drupal\lms\Controller\CourseController::activity(): Argument #3 ($activity_delta) must be of type int, string given in CourseController->activity() (line 81)
URL: /course/1/0/[object%20Object]
Referrer: /course/1/0/1

Notice the [object%20Object] in the url. It appears [object Object] is being passed instead of a numeric ID for $activity_delta.

Non-H5P activities are tracked and reported as expected.

Steps to reproduce

  1. Enable LMS H5P module and set
  2. Add H5P Activity type in /admin/lms/activity_type
  3. Set Widget to Editor under Form Display
  4. Add activity of type H5P and add to Module >> Course
  5. Complete all activities in Course
  6. Click Finish Course at the end

Notice "Course failed."
Go to my course-results
Answered Evaluated Score
Yes Yes 0

Notice a score of 0.

I tried setting up LMS xAPI and LRS but having issues with those (not sure if there's any connection there). I'm creating separate issues for those.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇺🇸United States GarChris

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

Comments & Activities

  • Issue created by @GarChris
  • 🇬🇧United Kingdom catch

    This module depends on lrs_xapi (or an equivalent LRS) so that might be causing the problem here. Please link those issues once they're open, but moving this to 'needs more info' for now.

  • 🇺🇸United States GarChris

    Here is the linked issue, xAPI Statements Not Sent to External LRS (TraxLRS)
    https://www.drupal.org/project/lms_xapi/issues/3530894 💬 xAPI Statements Not Sent to External LRS (TraxLRS) Active

  • 🇺🇸United States GarChris

    LMS H5P activities work as expected after properly configuring the lms_xapi to point to the internal lrs_xapi. Thank you for your responsiveness on this and the related issues.

  • 🇬🇧United Kingdom catch

    I'm still getting that malformed url "/course/5/0/[object%20Object]" and the error

    This is really confusing to me - can you confirm whether you've got custom JavaScript or similar running on that page? I'm wondering if something is appending things to the URL incorrectly or similar. I can't think of a way this could ever be generated purely from PHP - at least not by accident.

Production build 0.71.5 2024