Fixing complexity issue in AICC API
This commit is contained in:
37
src/AICC.js
37
src/AICC.js
@@ -1,14 +1,14 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import Scorm12API from './Scorm12API';
|
import Scorm12API from './Scorm12API';
|
||||||
import {
|
import {CMIEvaluationCommentsObject, CMITriesObject, NAV} from './cmi/aicc_cmi';
|
||||||
CMIInteractionsCorrectResponsesObject,
|
|
||||||
CMIInteractionsObject,
|
|
||||||
CMIInteractionsObjectivesObject,
|
|
||||||
CMIObjectivesObject
|
|
||||||
} from "./cmi/scorm12_cmi";
|
|
||||||
import {CMIEvaluationCommentsObject, CMITriesObject, NAV} from "./cmi/aicc_cmi";
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The AICC API class
|
||||||
|
*/
|
||||||
class AICC extends Scorm12API {
|
class AICC extends Scorm12API {
|
||||||
|
/**
|
||||||
|
* Constructor to create AICC API object
|
||||||
|
*/
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
@@ -18,31 +18,28 @@ class AICC extends Scorm12API {
|
|||||||
/**
|
/**
|
||||||
* Gets or builds a new child element to add to the array.
|
* Gets or builds a new child element to add to the array.
|
||||||
*
|
*
|
||||||
* @param CMIElement
|
* @param {string} CMIElement
|
||||||
* @param value
|
* @param {any} value
|
||||||
|
* @return {object}
|
||||||
*/
|
*/
|
||||||
getChildElement(CMIElement, value) {
|
getChildElement(CMIElement, value) {
|
||||||
let newChild;
|
let newChild = super.getChildElement(CMIElement);
|
||||||
|
|
||||||
if (this.stringContains(CMIElement, "cmi.objectives")) {
|
if (!newChild) {
|
||||||
newChild = new CMIObjectivesObject(this);
|
if (this.stringContains(CMIElement, 'cmi.evaluation.comments')) {
|
||||||
} else if (this.stringContains(CMIElement, ".correct_responses")) {
|
|
||||||
newChild = new CMIInteractionsCorrectResponsesObject(this);
|
|
||||||
} else if (this.stringContains(CMIElement, ".objectives")) {
|
|
||||||
newChild = new CMIInteractionsObjectivesObject(this);
|
|
||||||
} else if (this.stringContains(CMIElement, "cmi.interactions")) {
|
|
||||||
newChild = new CMIInteractionsObject(this);
|
|
||||||
} else if (this.stringContains(CMIElement, "cmi.evaluation.comments")) {
|
|
||||||
newChild = new CMIEvaluationCommentsObject(this);
|
newChild = new CMIEvaluationCommentsObject(this);
|
||||||
} else if (this.stringContains(CMIElement, "cmi.student_data.tries")) {
|
} else if (this.stringContains(CMIElement, 'cmi.student_data.tries')) {
|
||||||
newChild = new CMITriesObject(this);
|
newChild = new CMITriesObject(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return newChild;
|
return newChild;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace the whole API with another
|
* Replace the whole API with another
|
||||||
|
*
|
||||||
|
* @param {AICC} newAPI
|
||||||
*/
|
*/
|
||||||
replaceWithAnotherScormAPI(newAPI) {
|
replaceWithAnotherScormAPI(newAPI) {
|
||||||
// Data Model
|
// Data Model
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ export default class Scorm12API extends BaseAPI {
|
|||||||
* Gets or builds a new child element to add to the array.
|
* Gets or builds a new child element to add to the array.
|
||||||
*
|
*
|
||||||
* @param CMIElement
|
* @param CMIElement
|
||||||
|
* @param value
|
||||||
*/
|
*/
|
||||||
getChildElement(CMIElement, value) {
|
getChildElement(CMIElement, value) {
|
||||||
let newChild;
|
let newChild;
|
||||||
|
|||||||
Reference in New Issue
Block a user