Skip to content

Commit

Permalink
issue/2604 ensure score sent to LMS before status
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverfoster authored Nov 22, 2021
2 parents 8b9617f + f183178 commit 814825f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions js/tracking.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,21 @@ class Tracking extends Backbone.Controller {
onAssessmentComplete(assessmentState) {
this._assessmentState = assessmentState;

this.submitScore();
this.checkCompletion();
}

submitScore() {
if (!this._config._shouldSubmitScore) return;

if (this._assessmentState.isPercentageBased) {
Adapt.offlineStorage.set('score', this._assessmentState.scoreAsPercent, 0, 100);
return;
}

Adapt.offlineStorage.set('score', this._assessmentState.score, this._assessmentState.minScore, this._assessmentState.maxScore);
}

/**
* Restores the _assessmentState object when an assessment is registered.
* @param {object} assessmentState - An object representing the overall assessment state
Expand Down

0 comments on commit 814825f

Please sign in to comment.