Created on 15 April 2025, about 2 months ago

Problem/Motivation

I observed intermittent issues where sometimes a tutorial would be completed but the scorm_report would never have its status updated to "passed" as I would expect.

Steps to reproduce

The issue was intermittent but frequent. I would go through a tutorial that had quiz questions and would complete them. Finally I would click the last slide. I would then close out the tutorial and check the scorm_report table to see if it was marked "passed" or still stuck at "incomplete".

Proposed resolution

I tracked down the issue to these lines in src/ScormFieldCommonService.php file:

// Sometimes odd things happen with scorm data.
// If the raw score is the same never allow to change the status.
      if ($entity->getScoreRaw() != $score_data['raw']) {
        $entity->setStatus($status);
      }

In my case, a perfect score was being recorded prior to status getting set to "passed". So, even though I would verify that status was later being sent as "passed", the database would never be updated since the score wasn't changing at that point.

The comments in this code scare me, but I needed to do something to make this more flexible. I have temporarily changed the condition to this:

      if ($status == 'passed' || $status == 'completed') {
        $entity->setStatus($status);
      }

Can you advise? Will this be problematic? Am I the only one encountering an issue like this? If not, could this approach or similar be considered to be integrated into future releases?

Thanks in advance!

πŸ’¬ Support request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States rhankins

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

Comments & Activities

  • Issue created by @rhankins
  • πŸ‡¬πŸ‡§United Kingdom globexplorer

    In version 1.x only the first reached status get's written into the db. Some invalid scorms will not supply any status. In order to set the status correctly the below code makes sure of that. Only if the $status varialbe has the correct value it will write the status.

        if ($status == 'passed' || $status == 'completed') {
            $entity->setStatus($status);
          }
    

    Normally the raw scorm will be 0 per default, and a number if score already received.

    I think what you describe here can be related to 2 things:

    1. Problem with scorm itself.
    2. You try to make a second attempt, in version 1.0 once an attempt has been made it will not be updated.

  • πŸ‡ΊπŸ‡ΈUnited States rhankins

    @globexplorer, thanks for your reply. You said "In order to set the status correctly the below code makes sure of that." But the code you quoted is my attempt at a patch, not what is in the module code base currently.

    So, I'm attaching my patch for consideration of incorporating it into the module.

    This solves the issue I experienced where a raw score comes in at 100, prior to status being set (as passed or completed). This prevents the scenario where the status is stuck at incomplete even though they passed the quiz.

    Thanks for your consideration.

  • πŸ‡ΊπŸ‡ΈUnited States rhankins

    Sorry, I saw an error with my patch file. Reuploading.

Production build 0.71.5 2024