Skip to content

Commit

Permalink
Amend for resetting the models collection - fixes #180. (#181)
Browse files Browse the repository at this point in the history
Amend for resetting the models collection - fixes #180. (#181)
  • Loading branch information
danielghost committed Nov 28, 2022
1 parent 6f34443 commit 691ce2c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions js/adapt-assessmentArticleModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ const AssessmentModel = {
_onDataReady() {
// register assessment
Adapt.assessment.register(this);

// sanity check the data
const questions = this._getCurrentQuestionComponents();
if (this.get('_attemptInProgress') && questions.every(q => q.get('_isSubmitted')) && this.get('_requireCompletionOf') !== Number.POSITIVE_INFINITY) {
Expand Down Expand Up @@ -154,7 +154,7 @@ const AssessmentModel = {
_assessmentCompleteInSession: false
});
}
this.getChildren().models = this._originalChildModels;
this.getChildren().reset(this._originalChildModels);
if (assessmentConfig?._banks._isEnabled &&
assessmentConfig?._banks._split.length > 1) {
quizModels = this._setupBankedAssessment();
Expand All @@ -169,7 +169,7 @@ const AssessmentModel = {
quizModels = this.getChildren().models;
logging.warn('assessment: Not enough unique questions to create a fresh assessment, using last selection');
}
this.getChildren().models = quizModels;
this.getChildren().reset(quizModels);
this.setupCurrentQuestionComponents();
if (shouldResetAssessment || shouldResetQuestions) {
this._resetQuestions();
Expand Down Expand Up @@ -685,7 +685,7 @@ const AssessmentModel = {

if (blocks.length) {
const nonBlockChildren = this.getChildren().models.filter(model => !model.isTypeGroup('block'));
this.getChildren().models = blocks.concat(nonBlockChildren);
this.getChildren().reset(blocks.concat(nonBlockChildren));
}

const _questions = [];
Expand Down

0 comments on commit 691ce2c

Please sign in to comment.