GithubHelp home page GithubHelp logo

Comments (8)

paulstevendev avatar paulstevendev commented on June 8, 2024 1

Surely this code is not checking isSupported('cmi.interactions._count')

https://github.com/adaptlearning/adapt-contrib-spoor/blob/f07a6032a687b6653c4dbcd903797663fa3ec665/js/adapt-stateful-session.js#L213C1-L215C34

const id = this._uniqueInteractionIds ?${this.scorm.getInteractionCount()}-${questionModel.get('_id')} : questionModel.get('_id');

from adapt-contrib-spoor.

oliverfoster avatar oliverfoster commented on June 8, 2024 1

Yup, agreed. Needs an if (!this.scorm.isSupported('cmi.interactions._count')) return; above that line?

from adapt-contrib-spoor.

paulstevendev avatar paulstevendev commented on June 8, 2024 1

That is exactly what I have done and testing as we speak

from adapt-contrib-spoor.

oliverfoster avatar oliverfoster commented on June 8, 2024 1

You can fork the repo, create your issue/294 and then pr from there.

from adapt-contrib-spoor.

paulstevendev avatar paulstevendev commented on June 8, 2024 1

Done

from adapt-contrib-spoor.

oliverfoster avatar oliverfoster commented on June 8, 2024

The quoted lines, call offlineStorage.set('interaction', id, response, result, latency, responseType); :

onQuestionRecordInteraction(questionView) {
if (!this._shouldRecordInteractions) return;
// View functions are deprecated: getResponseType, getResponse, isCorrect, getLatency
const questionModel = questionView.model;
const responseType = (questionModel.getResponseType ? questionModel.getResponseType() : questionView.getResponseType());
// If responseType doesn't contain any data, assume that the question
// component hasn't been set up for cmi.interaction tracking
if (_.isEmpty(responseType)) return;
const id = this._uniqueInteractionIds
? `${this.scorm.getInteractionCount()}-${questionModel.get('_id')}`
: questionModel.get('_id');
const response = (questionModel.getResponse ? questionModel.getResponse() : questionView.getResponse());
const result = (questionModel.isCorrect ? questionModel.isCorrect() : questionView.isCorrect());
const latency = (questionModel.getLatency ? questionModel.getLatency() : questionView.getLatency());
offlineStorage.set('interaction', id, response, result, latency, responseType);
}

Which is calling recordInteraction:

set(name, value) {
// Convert arguments to array and drop the 'name' parameter
const args = [...arguments].slice(1);
const isObject = typeof name === 'object';
if (isObject) {
value = name;
name = 'suspendData';
}
if (this.useTemporaryStore()) {
if (isObject) {
Object.assign(this.temporaryStore, value);
} else {
this.temporaryStore[name] = value;
}
return true;
}
switch (name.toLowerCase()) {
case 'interaction':
return this.scorm.recordInteraction(...args);

Which is calling isSupported, if (!this.isSupported('cmi.interactions._count')) { :

recordInteraction(id, response, correct, latency, type) {
if (!this.isSupported('cmi.interactions._count')) {
this.logger.info('ScormWrapper::recordInteraction: cmi.interactions are not supported by this LMS...');
return;
}
switch (type) {
case 'choice':
this.recordInteractionMultipleChoice.apply(this, arguments);
break;
case 'matching':
this.recordInteractionMatching.apply(this, arguments);
break;
case 'numeric':
this.isSCORM2004() ? this.recordInteractionScorm2004.apply(this, arguments) : this.recordInteractionScorm12.apply(this, arguments);
break;
case 'fill-in':
this.recordInteractionFillIn.apply(this, arguments);
break;
default:
console.error(`ScormWrapper.recordInteraction: unknown interaction type of '${type}' encountered...`);
}
}

isSupported calls get:

isSupported(property) {
this.logger.debug(`ScormWrapper::isSupported: _property=${property}`);
if (this.finishCalled) {
this.logger.debug('ScormWrapper::isSupported: ignoring request as \'finish\' has been called');
return;
}
if (!this.lmsConnected) {
this.handleConnectionError();
return false;
}
this.scorm.get(property);
return (this.scorm.debug.getCode() !== 401); // 401 is the 'not implemented' error code
}

getValue is called here:

pipwerks.SCORM.data.get = function(parameter) {
var value = null,
scorm = pipwerks.SCORM,
trace = pipwerks.UTILS.trace,
debug = scorm.debug,
traceMsgPrefix = "SCORM.data.get('" + parameter + "') ";
if (scorm.connection.isActive) {
var API = scorm.API.getHandle(),
errorCode = 0;
if (API) {
switch (scorm.version) {
case "1.2":
value = API.LMSGetValue(parameter);
break;
case "2004":
value = API.GetValue(parameter);
break;
}

Your error is triggering here:

getValue(property) {
this.logger.debug(`ScormWrapper::getValue: _property=${property}`);
if (this.finishCalled) {
this.logger.debug('ScormWrapper::getValue: ignoring request as \'finish\' has been called');
return;
}
if (!this.lmsConnected) {
this.handleConnectionError();
return;
}
const value = this.scorm.get(property);
const errorCode = this.scorm.debug.getCode();
switch (errorCode) {
case 0:
break;
case 403:
// 403 errors are common (and normal) when targetting SCORM 2004 - they are triggered on any
// attempt to get the value of a data model element that hasn't yet been assigned a value.
this.logger.warn('ScormWrapper::getValue: data model element not initialized');
break;
default:
this.handleDataError(new ScormError(CLIENT_COULD_NOT_GET_PROPERTY, {

This is your error:

CLIENT_COULD_NOT_GET_PROPERTY: 'Unable to get the value of {{property}} from the Learning Management System\n\nError: {{errorCode}} - {{{errorInfo}}}\nLMS Error Info: {{{diagnosticInfo}}}',

So it is checking, but the check pushes an error to the dialogue.

This is where the dialogue is shown:

if (!this.suppressErrors && (!this.logOutputWin || this.logOutputWin.closed) && confirm(`${messages.title}:\n\n${message}\n\n${messages.pressOk}`)) {
this.showDebugWindow();
}

It can be controlled with:

"_suppressErrors": false,

However, it does seem a bit odd. isSupported shouldn't really display an error if the value isn't supported.

@danielghost any thoughts?

from adapt-contrib-spoor.

paulstevendev avatar paulstevendev commented on June 8, 2024

@oliverfoster happy to create a PR for this.

Not done this before so just checking the procedure

Do I create a local branch issue/294 and then push this up (I don't appear to have permission to do so)

Then create a PR

from adapt-contrib-spoor.

github-actions avatar github-actions commented on June 8, 2024

🎉 This issue has been resolved in version 5.9.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

from adapt-contrib-spoor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.