Skip to content

Commit

Permalink
Resolves #2398, re-populates _assessmentState from 'assessments:regis…
Browse files Browse the repository at this point in the history
…ter' (#2402)

This corrects an issue with incorrect course completion statuses being passed back
when a course was being completed over multiple sessions.
  • Loading branch information
brian-learningpool authored Apr 3, 2019
1 parent 663f44a commit d135086
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "adapt_framework",
"version": "3.5.2",
"version": "3.5.3",
"description": "Adapt Learning output framework",
"repository": {
"type": "git",
Expand Down
14 changes: 13 additions & 1 deletion src/core/js/tracking.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ define([
setupEventListeners: function() {
// Check if completion requires passing an assessment.
if (this._config._requireAssessmentCompleted) {
this.listenTo(Adapt, 'assessment:complete', this.onAssessmentComplete);
this.listenTo(Adapt, {
'assessment:complete': this.onAssessmentComplete,
'assessments:register': this.onAssessmentRestored
});
}

// Check if completion requires completing all content.
Expand All @@ -39,6 +42,15 @@ define([
this.checkCompletion();
},

/**
* Restores the _assessmentState object when an assessment is registered.
* @param {object} state - An object representing the (intial) assessment state
* @param {assessmentModel} - A restored Assessment model
*/
onAssessmentRestored: function(state, assessmentModel) {
this._assessmentState = assessmentModel.getState();
},

/**
* Evaluate the course and assessment completion.
*/
Expand Down

1 comment on commit d135086

@muthuselvan86
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks clean!

Please sign in to comment.