From 5de3adf6df0d4ae475134aff166bfc003a15c159 Mon Sep 17 00:00:00 2001 From: joe-allen-89 <85872286+joe-allen-89@users.noreply.github.com> Date: Thu, 3 Oct 2024 16:37:30 +0100 Subject: [PATCH] Fix: on reset check if navigating from a different contentObject (fixes #205) --- js/adapt-assessmentArticleModel.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/adapt-assessmentArticleModel.js b/js/adapt-assessmentArticleModel.js index e114156..c3d9b15 100644 --- a/js/adapt-assessmentArticleModel.js +++ b/js/adapt-assessmentArticleModel.js @@ -607,11 +607,13 @@ const AssessmentModel = { this._forceResetOnRevisit = false; const isPageReload = this._checkReloadPage(); + const isNavigating = this.get('_parentId') !== location._currentId; // stop resetting if not complete or not allowed if (this.get('_assessmentCompleteInSession') && !assessmentConfig._isResetOnRevisit && !isPageReload && + !isNavigating && !force) { // eslint-disable-next-line n/no-callback-literal if (typeof callback === 'function') callback(false); @@ -638,6 +640,8 @@ const AssessmentModel = { return false; } + if (isNavigating) this._forceResetOnRevisit = true; + if (!isPageReload) { this._setupAssessmentData(force); // eslint-disable-next-line n/no-callback-literal