Skip to content

Commit

Permalink
Merge pull request #112 from adaptlearning/develop
Browse files Browse the repository at this point in the history
push develop to master
  • Loading branch information
moloko committed Oct 29, 2015
2 parents d0a6fe7 + 56f714a commit 3d392b1
Show file tree
Hide file tree
Showing 10 changed files with 417 additions and 221 deletions.
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,30 +59,33 @@ The attributes listed below are used in *config.json* to configure **Spoor**, an

**_spoor**: (object): The Spoor object that contains values for **_isEnabled**, **_tracking**, **_reporting**, and **_advancedSettings**.

>**_isEnabled** (boolean): Enables/disables the **Spoor** extension. If set to `true` (the default value), the plugin will try to connect to a SCORM conformant LMS on course launch. If one is not available, a 'Could not connect to LMS' error message will be display. This error may be ignored, or it may be avoided entirely by setting this to `false`. Disabling tracking in this way can be very helpful during course development (when running the course from a local server rather than an LMS) or if you have a course that needs to be able to run on an LMS or a web server.
>**_isEnabled** (boolean): Enables/disables the **Spoor** extension. If set to `true` (the default value), the plugin will try to connect to a SCORM conformant LMS on course launch. If one is not available, a 'Could not connect to LMS' error message will be displayed. This error may be ignored, or it may be avoided entirely by setting this to `false`. Disabling tracking in this way can be very helpful during course development (when running the course from a local server rather than an LMS) or if you have a course that needs to be able to run on an LMS or a web server.
>**_tracking** (object): This object contains values for **_requireCourseCompleted**, **_requireAssessmentPassed**, **_shouldSubmitScore**.

>>**_requireCourseCompleted** (boolean): Determines whether the learner must complete all the components in the course before the course can be marked as finished in the LMS. Acceptable values are `true` or `false`. The default is `true`.
>>**_requireCourseCompleted** (boolean): Determines whether the learner must complete all the components in the course before the course can be marked as finished in the LMS. Acceptable values are `true` or `false`. The default is `false`.
>>**_requireAssessmentPassed** (boolean): Determines whether the user must pass the course assessment, not simply complete it, before the course can be marked as finished in the LMS. Acceptable values are `true` or `false`. The default is `false`. If this attribute and `_requireCourseCompleted` are both set to `true`, the learner must pass the course assessment as well as complete all components in order for the course can be marked as finished in the LMS.
>>**_shouldSubmitScore** (boolean): Determines whether the numeric scores attained in assessments will be reported to the LMS. Acceptable values are `true` or `false`.
>>**_shouldSubmitScore** (boolean): Determines whether the numeric scores attained in assessments will be reported to the LMS. Acceptable values are `true` or `false`. The default is `false`.
>>**_shouldStoreResponses** (boolean): Determines whether the user's responses to questions should be persisted across sessions (by storing them in `cmi.suspend_data`) or not. Acceptable values are `true` or `false`. The default is `false`. Note that if you set this to `true`, the user will not be able to attempt questions within the course again unless some mechanism for resetting them is made available (for example, see `_isResetOnRevisit` in [adapt-contrib-assessment](https://github.com/adaptlearning/adapt-contrib-assessment)).
>>**_shouldRecordInteractions** (boolean): Determines whether the user's responses to questions should be tracked to the `cmi.interactions` fields of the SCORM data model or not. Acceptable values are `true` or `false`. The default is `true`. Note that not all SCORM 1.2 conformant Learning Management Systems support `cmi.interactions`. The code will attempt to detect whether support is implemented or not and, if not, will fail gracefully. Occasionally the code is unable to detect when `cmi.interactions` are not supported, in those (rare) instances you can switch off interaction tracking using this property so as to avoid 'not supported' errors. You can also switch off interaction tracking for any individual question using the `_recordInteraction` property of question components. All core question components support recording of interactions, community components will not necessarily do so.
>>**_shouldStoreResponses** (boolean): Determines whether the user's question responses should be saved and restored, to and from the LMS. Acceptable values are `true` or `false`.
>**_reporting** (object): This object defines what status to report back to the LMS. Contains values for **_onTrackingCriteriaMet**, **_onAssessmentFailure**.
>>**_onTrackingCriteriaMet** (string): Specifies the status that is reported to the LMS when the tracking criteria are met. Acceptable values are: `"completed"`, `"passed"`, `"failed"`, and `"incomplete"`. If you are tracking a course by assessment, you would typically set this to `"passed"`. Otherwise, `"completed"` is the usual value.
>>**_onAssessmentFailure** (string): Specifies the status that is reported to the LMS when the assessment is failed. Acceptable values are `"failed"` and `"incomplete"`. Some Learning Management Systems will prevent the user from making further attempts at the course after status has been set to `"failed"`. Therefore, it is common to set this to `"incomplete"` to allow the user more attempts to pass an assessment.
>**_advancedSettings** (object): The advance settings attribute group contains values for **_scormVersion**, **_showDebugWindow**, **_commitOnStatusChange**, **_timedCommitFrequency**, **_maxCommitRetries**, and **_commitRetryDelay**.
>**_advancedSettings** (object): The advanced settings attribute group contains values for **_scormVersion**, **_showDebugWindow**, **_commitOnStatusChange**, **_timedCommitFrequency**, **_maxCommitRetries**, and **_commitRetryDelay**.
>>**_scormVersion** (string): This text defines what version of SCORM is targeted. Only SCORM 1.2 is officially supported by Adapt. SCORM 2004 should work, but Adapt doesn't include this version in testing. To enable SCORM 2004 support, change this value to `"2004"` and include the relevant SCORM 2004 packaging files (*imsmanifest.xml* and others). The default is `"1.2"`.
>>**_showDebugWindow** (boolean): If set to `true`, a pop-up window will be shown on course launch that gives detailed information about what SCORM calls are being made. This can be very useful for debugging SCORM issues. Note that this pop-up window will appear automatically if the SCORM code encounters an error, even if this is set to `false`. The default is `false`.
>>**_suppressErrors** (boolean): If set to `true`, an alert dialog will NOT be shown when a SCORM error occurs. Errors will still be logged but the user will not be informed that a problem has occurred. Note that setting **_showDebugWindow** to `true` will still cause the debug popup window to be shown on course launch, this setting merely suppresses the alert dialog that would normally be shown when a SCORM error occurs. *This setting should be used with extreme caution as, if enabled, users will not be told about any LMS connectivity issues or other SCORM tracking problems.*
>>**_commitOnStatusChange** (boolean): Determines whether a "commit" call should be made automatically every time the SCORM *lesson_status* is changed. The default is `true`.
>>**_timedCommitFrequency** (number): Specifies the frequency - in minutes - at which a "commit" call will be made. Set this value to `0` to disable automatic commits. The default is `10`.
Expand Down
6 changes: 4 additions & 2 deletions example.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"_requireCourseCompleted": true,
"_requireAssessmentPassed": false,
"_shouldSubmitScore": false,
"_shouldStoreResponses": false
"_shouldStoreResponses": false,
"_shouldRecordInteractions": true
},
"_reporting": {
"_comment": "Your options here are 'completed', 'passed', 'failed', and 'incomplete'",
Expand All @@ -17,10 +18,11 @@
"_comment": "You only need to include this section if you want to change any of the default values. You only need include settings you want to change.",
"_scormVersion": "1.2",
"_showDebugWindow": false,
"_suppressErrors": false,
"_commitOnStatusChange": false,
"_timedCommitFrequency": 10,
"_maxCommitRetries": 5,
"_commitRetryDelay": 2000
}
}
}
}
13 changes: 9 additions & 4 deletions js/adapt-contrib-spoor.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ define([

scorm.setVersion(settings._scormVersion || "1.2");

if(settings.hasOwnProperty("_suppressErrors")) {
scorm.suppressErrors = settings._suppressErrors;
}

if(settings.hasOwnProperty("_commitOnStatusChange")) {
scorm.commitOnStatusChange = settings._commitOnStatusChange;
}
Expand All @@ -65,11 +69,12 @@ define([
if(settings.hasOwnProperty("_commitRetryDelay")) {
scorm.commitRetryDelay = settings._commitRetryDelay;
}
} else {
/**
* Adapt doesn't yet support cmi.interactions, uncomment this when support is added
if(settings.hasOwnProperty("_disableInteractionTracking")) {
scorm.disableInteractionTracking = settings._disableInteractionTracking;
}*/
* force use of SCORM 1.2 by default - some LMSes (SABA/Kallidus for instance) present both APIs to the SCO and, if given the choice,
* the pipwerks code will automatically select the SCORM 2004 API - which can lead to unexpected behaviour.
*/
scorm.setVersion("1.2");
}
},

Expand Down
2 changes: 2 additions & 0 deletions js/adapt-offlineStorage-scorm.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ define([

//Set by name
switch (name.toLowerCase()) {
case "interaction":
return scorm.recordInteraction.apply(scorm, args );
case "location":
return scorm.setLessonLocation.apply(scorm, args );
case "score":
Expand Down
21 changes: 21 additions & 0 deletions js/adapt-stateful-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ define([
_sessionID: null,
_config: null,
_shouldStoreResponses: false,
_shouldRecordInteractions: true,

//Session Begin
initialize: function() {
Expand All @@ -24,7 +25,13 @@ define([
this._config = Adapt.config.has('_spoor')
? Adapt.config.get('_spoor')
: false;

this._shouldStoreResponses = (this._config && this._config._tracking && this._config._tracking._shouldStoreResponses);

// default should be to record interactions, so only avoid doing that if _shouldRecordInteractions is set to false
if(this._config && this._config._tracking && this._config._tracking._shouldRecordInteractions === false) {
this._shouldRecordInteractions = false;
}
},

checkSaveState: function() {
Expand Down Expand Up @@ -75,6 +82,10 @@ define([
this.listenTo(Adapt.components, 'change:_isInteractionComplete', this.onQuestionComponentComplete);
}

if(this._shouldRecordInteractions) {
this.listenTo(Adapt, 'questionView:recordInteraction', this.onQuestionRecordInteraction);
}

this.listenTo(Adapt.blocks, 'change:_isComplete', this.onBlockComplete);
this.listenTo(Adapt.course, 'change:_isComplete', this.onCompletion);
this.listenTo(Adapt, 'assessment:complete', this.onAssessmentComplete);
Expand Down Expand Up @@ -111,6 +122,16 @@ define([
}
},

onQuestionRecordInteraction:function(questionView) {
var id = questionView.model.get('_id');
var latency = questionView.getLatency();
var response = questionView.getResponse();
var responseType = questionView.getResponseType();
var result = questionView.isCorrect();

Adapt.offlineStorage.set("interaction", id, response, result, latency, responseType);
},

submitScore: function(score) {
if (this._config && !this._config._tracking._shouldSubmitScore) return;

Expand Down
Loading

0 comments on commit 3d392b1

Please sign in to comment.