cgkineo / adapt-xAPI

An extension to utilise The Experience API (xAPI) to collect data on human performance, stored within a suitable Learning Record Store (LRS).
GNU General Public License v3.0
2 stars 1 forks source link

SCORM Cloud, Rustici Engine actor.account #14

Closed danielghost closed 1 year ago

danielghost commented 4 years ago

The Rustici engine used in SCORM Cloud uses an invalid actor.account. Incorrect attribute names are used, plus the values of these are stored in an Array which doesn't match the xAPI spec.

Whilst we have been aware of this issue for a long time, I am noting it here for others. It was previously decided not to amend the plugin to convert this as required, as the engine should match the spec rather than the plugin providing a workaround. If required, the following code can be added to: https://github.com/cgkineo/adapt-xAPI/blob/8409e1ba5a1fdf71d821badba2933a5ce95b4b0f/js/launchModel.js#L30

var actor = JSON.parse(lrs.actor);

// convert actor for Rustici Engine
if (Array.isArray(actor.name)) actor.name = actor.name[0];
//if (Array.isArray(actor.mbox)) actor.mbox = actor.mbox[0];

if (Array.isArray(actor.account)) {
    var accountArr = actor.account[0];

    var account = {
        homePage: accountArr.accountServiceHomePage || accountArr.homePage,
        name: accountArr.accountName || accountArr.name
    };

    actor.account = account;
}

The following actor value needs to be adjusted accordingly to pass in the new actor variable instead: https://github.com/cgkineo/adapt-xAPI/blob/8409e1ba5a1fdf71d821badba2933a5ce95b4b0f/js/launchModel.js#L37