Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding profile act type to statements #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 50 additions & 47 deletions SCORMToXAPIFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,23 @@ xapi = function () {
definition: {
type: "http://adlnet.gov/expapi/activities/attempt"
}
},
},
{
id: config.courseId,
objectType: "Activity",
definition: {
type: "http://adlnet.gov/expapi/activities/course"
}
}
],
}
],
category: [
{
id: "https://w3id.org/xapi/scorm"
}
]
id: "https://w3id.org/xapi/scorm",
definition: {
type: "http://adlnet.gov/expapi/activities/profile"
}
}
]
}
}
};
Expand Down Expand Up @@ -160,29 +163,32 @@ xapi = function () {
definition: {
type: "http://adlnet.gov/expapi/activities/lesson"
}
}
],
}
],
grouping: [
{
id: "",
objectType: "Activity",
definition: {
type: "http://adlnet.gov/expapi/activities/attempt"
}
},
},
{
id: config.courseId,
objectType: "Activity",
definition: {
type: "http://adlnet.gov/expapi/activities/course"
}
}
],
}
],
category: [
{
id: "https://w3id.org/xapi/scorm"
}
]
id: "https://w3id.org/xapi/scorm",
definition: {
type: "http://adlnet.gov/expapi/activities/profile"
}
}
]
}
},
result: {
Expand Down Expand Up @@ -314,10 +320,7 @@ xapi = function () {

// send a suspended statement to replace the (voided) terminated statement
suspendAttempt(terminateStmt.timestamp);


}

}


Expand Down Expand Up @@ -643,8 +646,6 @@ xapi = function () {
if (cmi_total_time != "")
state.total_time = cmi_total_time;



// see if the profile is already set
var as = ADL.XAPIWrapper.getState(attemptIri, agent, constants.attemptStateIri);

Expand All @@ -665,35 +666,37 @@ xapi = function () {
**
*******************************************************************************/
var saveDataValue = function (name, value) {
var isInteraction = name.indexOf("cmi.interactions") > -1;
var isInteraction = name.indexOf("cmi.interactions") > -1;

if (isInteraction) {
setInteraction(name, value);
} else {
// Handle only non-array scorm data model elements
switch (name) {
case scormVersionConfig.scoreScaledElement:
setScore(value);
break;
case scormVersionConfig.completionElement:
setComplete(value);
break;
case scormVersionConfig.successElement:
setSuccess(value);
break;
case scormVersionConfig.exitElement:
exitSetToSuspend = (value == "suspend");
break;
default:
break;
}
if (isInteraction) {
setInteraction(name, value);
} else {
// Handle only non-array scorm data model elements
switch (name) {
case scormVersionConfig.scoreScaledElement:
setScore(value);
break;
case scormVersionConfig.completionElement:
setComplete(value);
break;
case scormVersionConfig.successElement:
setSuccess(value);
break;
case scormVersionConfig.exitElement:
exitSetToSuspend = (value == "suspend");
break;
default:
break;
}
}
/*******************************************************************************
**
** This function/vars is used to handle the interaction type
**
*******************************************************************************/
}


/*******************************************************************************
**
** This function/vars is used to handle the interaction type
**
*******************************************************************************/
var setInteraction = function (name, value) {
// key for interactions in local storage is scoped to an attempt
var interactionsKey = window.localStorage[config.activityId] + "_interactions";
Expand Down Expand Up @@ -822,9 +825,9 @@ xapi = function () {
}
}
}

}


/*******************************************************************************
**
** This function is used to get an interaction iri
Expand All @@ -834,6 +837,7 @@ xapi = function () {
return config.activityId + "/interactions/" + encodeURIComponent(interactionId);
}


/*******************************************************************************
**
** This function is used to set a scaled score
Expand Down Expand Up @@ -975,7 +979,6 @@ xapi = function () {
suspendDataElement: "cmi.suspend_data",
totalTimeElement: (config.isScorm2004) ? "cmi.total_time" : "cmi.core.total_time"
}

}

/*******************************************************************************
Expand Down