xAPI-vle / moodle-logstore_xapi

A Moodle plugin to send xAPI statements to an LRS using events in the Moodle logstore.
GNU General Public License v3.0
75 stars 85 forks source link

3 event(s) have failed to send to the LRS - \mod_scorm\event\sco_launched #772

Closed RussellEngland closed 4 years ago

RussellEngland commented 4 years ago

Description

When cron runs, this error displays "event(s) have failed to send to the LRS"

Execute scheduled task: Emit records to LRS (logstore_xapi\task\emit_task) ... started 10:03:04. Current memory use 54.9MB. 3 event(s) have failed to send to the LRS. 9 event(s) have been successfully processed. ... used 48 dbqueries ... used 0.35917282104492 seconds Scheduled task complete: Emit records to LRS (logstore_xapi\task\emit_task)

Looking through the code, just before the message is displayed, the failed events are added to

mdl_logstore_xapi_failed_log

Looking through the table, the failed event is

\mod_scorm\event\sco_launched

Any ideas why its failing?

Version

tag v4.6.0

$plugin->version = 2018082100;

mlynn-lp commented 4 years ago

The objectid recorded in mdl_logstore_standard_log for sco_launched activities is the scoid.

This is incorrectly used here: $scorm = $repo->read_record_by_id('scorm', $event->objectid); This code throws an exception if the $event->objectid is not found.

Affected file: admin/tool/log/store/xapi/transformer/events/mod_scorm/sco_launched.php

Suggested solution:

$scormscoes = $DB->get_record('scorm_scoes', array('id' => $event->objectid), 'scorm');
$scorm = $repo->read_record_by_id('scorm', $scormscoes->scorm);

I have a fixed for the transformation of sco_launched events but it hasn't been merged into this branch. https://github.com/xAPI-vle/moodle-logstore_xapi/issues/344

RussellEngland commented 4 years ago

@mlynn-lp - that's awesome! Cheers dude! I didn't expect such a speedy response.

RussellEngland commented 4 years ago

Just to add, don't forget to add global $DB;