GithubHelp home page GithubHelp logo

Comments (3)

oliverfoster avatar oliverfoster commented on June 8, 2024

I don't understand. That function is just for showing the state as a string of 0/1/-, it has nothing to do with completion. Is the course completing on the lms but the console log say's it isn't, or is the course not completing and the console log is also not completing?

printCompletionInformation(suspendData) {
if (typeof suspendData === 'string') {
// In-case LMS data is passed as a string
suspendData = JSON.parse(suspendData);
}
const courseState = SCORMSuspendData.deserialize(suspendData.c);
const courseComplete = courseState[0];
const assessmentPassed = courseState[1];
const trackingIdModels = data.filter(model => model.get('_type') === this._trackingIdType && model.has('_trackingId'));
const trackingIds = trackingIdModels.map(model => model.get('_trackingId'));
if (!trackingIds.length) {
logging.info(`course._isComplete: ${courseComplete}, course._isAssessmentPassed: ${assessmentPassed}, ${this._trackingIdType} completion: no tracking ids found`);
return;
}
const completionData = SCORMSuspendData.deserialize(suspendData.q);
const max = Math.max(...completionData.map(item => item[0][0]));
const shouldStoreResponses = (completionData[0].length === 3);
const completionString = completionData.reduce((markers, item) => {
const trackingId = item[0][0];
const isComplete = shouldStoreResponses ?
item[2][1][0] :
item[1][0];
const mark = isComplete ? '1' : '0';
markers[trackingId] = (markers[trackingId] === '-' || markers[trackingId] === '1') ?
mark :
'0';
return markers;
}, (new Array(max + 1).join('-').split(''))).join('');
logging.info(`course._isComplete: ${courseComplete}, course._isAssessmentPassed: ${assessmentPassed}, ${this._trackingIdType} completion: ${completionString}`);
}

const max is the maxiumumtrackingId, they live at item[0][0]

const max = Math.max(...completionData.map(item => item[0][0]));

const trackingId reads the same value from each item[0][0]

const trackingId = item[0][0];

An array of character is made using this line, which is one character too short with new Array(max + 1).join('-').split(''), it should be max+2, one for index to length conversion, and one for the split+join losing a place. Or it could just be changed to new Array(max + 1).fill('-'), which does the same thing without the confusion.

}, (new Array(max + 1).join('-').split(''))).join('');

So aside from this bug, in this bit of code, what are the symptoms of the course and its completion? What do you have in the course and how have you set it up to complete? Assessment + content?

from adapt-contrib-spoor.

jonas-jelinski avatar jonas-jelinski commented on June 8, 2024

Hi Oliver,

thank you for your answer.

About your questions:

  1. Is the course completing on the lms but the console log say's it isn't, or is the course not completing and the console log is also not completing?
  • if we run the course localy on my notebook without lms: console log says the course is completed
  • if we run the course on a lms the lms and the console log says it is not completed
  1. We set the course up. Condition for completion:
  • assessment: no
  • content: yes
  1. In the course we have different adapt components. We have the same issue on different courses with different content.

  2. We tested the course:
    If we change the line:
    markers[trackingId] = markers[trackingId] === "-" || markers[trackingId] === "1" ? mark : "0";
    to
    markers[trackingId] = markers[trackingId] === "-" || markers[trackingId] === "1" ? mark : "1";
    the lms sets the course “completed”.

  3. We tested the course e.g. on SCORM Cloud.

from adapt-contrib-spoor.

oliverfoster avatar oliverfoster commented on June 8, 2024

Ignore the console for the moment. Does the LMS say the course has been completed?

This code should fix the console
9e07fbf

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.