Picture of Rob Mausser
Pass variable (scorm or not) to LMS on page completion
by Rob Mausser - Monday, 21 October 2019, 5:53 PM
 

We are building a course where the user will get an achievement on our LMS when they complete each page (or content-object) in Adapt. There will be 12 pages within the Adapt course. 

Is there any way to grab page completion from Adapt from Scorm or otherwise and pass it to the LMS? 

We are the developers of the LMS so we also have complete control over that side of things.

Thanks. 

Picture of Matt Leathes
Re: Pass variable (scorm or not) to LMS on page completion
by Matt Leathes - Tuesday, 22 October 2019, 9:25 AM
 

I suppose it all depends whether you're trying to do this as a custom thing or whether you are trying to stick to being SCORM conformant. If you're doing this in a custom way, then this is the code you might add to Adapt:

Adapt.contentObjects.on('change:_isComplete', function (contentObject) {
  console.log('page "' + contentObject.get('_id') + ' - ' + contentObject.get('title') + '" completed!');
  // send data to LMS about this event
});

If you wanted to do it whilst sticking within the bounds of SCORM then you'd want to use something like cmi.objectives - but unfortunately Adapt doesn't have any support for that yet as it crops up so rarely as a requirement. There is a PR for adding support for it here but I think it needs a fair bit of work as it feels overly complicated to use as it is.

Picture of Rob Mausser
Re: Pass variable (scorm or not) to LMS on page completion
by Rob Mausser - Tuesday, 22 October 2019, 3:09 PM
 

Thanks for this, Cheers. 

Picture of Rob Mausser
Re: Pass variable (scorm or not) to LMS on page completion
by Rob Mausser - Sunday, 3 November 2019, 7:57 PM
 

Hey so this works, but too well! Maybe its where I am putting it. Im high jacking the page progress extension and putting this code in completioncalculations.js. 

 

The problem is that on page completion it posts to the log..... 74 times! 

Any reason why thats happening?

 

Thanks

Picture of Matt Leathes
Re: Pass variable (scorm or not) to LMS on page completion
by Matt Leathes - Monday, 4 November 2019, 10:36 AM
 

Without being able to see the code it's hard to be sure but my best guess is that you've placed it inside some code that's run repeatedly, leading to repeated addition of the event listener.

A better place to put it might be in adapt-contrib-pageLevelProgress.js in the function setUpEventListeners. If you do put it there you can use the Backbone listenTo function instead i.e.

this.listenTo(Adapt.contentObjects, 'change:_isComplete', function (contentObject) {
  console.log('page "' + contentObject.get('_id') + ' - ' + contentObject.get('title') + '" completed!');
  // send data to LMS about this event
});
Picture of Rob Mausser
Re: Pass variable (scorm or not) to LMS on page completion
by Rob Mausser - Monday, 11 November 2019, 10:25 PM
 

This worked thank you

Picture of Matt Leathes
Re: Pass variable (scorm or not) to LMS on page completion
by Matt Leathes - Tuesday, 12 November 2019, 6:04 PM
 

No problem!