Fixes and additional test cases

This commit is contained in:
Jonathan Putney
2019-11-15 21:54:49 -05:00
parent 4dda8820ee
commit d548330436
7 changed files with 95 additions and 34 deletions

View File

@@ -223,11 +223,14 @@ export class CMIScore extends BaseCMI {
* @return {{min: string, max: string, raw: string}}
*/
toJSON() {
return {
this.jsonString = true;
const result = {
'raw': this.raw,
'min': this.min,
'max': this.max,
};
delete this.jsonString;
return result;
}
}

View File

@@ -67,6 +67,23 @@ function check2004ValidRange(value: any, rangePattern: String) {
* Class representing cmi object for SCORM 2004
*/
export class CMI extends BaseCMI {
/**
* Constructor for the SCORM 2004 cmi object
* @param {boolean} initialized
*/
constructor(initialized: boolean) {
super();
this.learner_preference = new CMILearnerPreference();
this.score = new Scorm2004CMIScore();
this.comments_from_learner = new CMICommentsFromLearner();
this.comments_from_lms = new CMICommentsFromLMS();
this.interactions = new CMIInteractions();
this.objectives = new CMIObjectives();
if (initialized) this.initialize();
}
#_version = '1.0';
#_children = constants.cmi_children;
#completion_status = 'unknown';
@@ -88,23 +105,6 @@ export class CMI extends BaseCMI {
#time_limit_action = 'continue,no message';
#total_time = '0';
/**
* Constructor for the SCORM 2004 cmi object
* @param {boolean} initialized
*/
constructor(initialized: boolean) {
super();
this.learner_preference = new CMILearnerPreference();
this.score = new Scorm2004CMIScore();
this.comments_from_learner = new CMICommentsFromLearner();
this.comments_from_lms = new CMICommentsFromLMS();
this.interactions = new CMIInteractions();
this.objectives = new CMIObjectives();
if (initialized) this.initialize();
}
/**
* Called when the API has been initialized after the CMI has been created
*/