From 8342e944a2daf2debfa376005464f3f737b0f5a2 Mon Sep 17 00:00:00 2001 From: danielghost Date: Fri, 3 May 2024 11:03:44 +0100 Subject: [PATCH] Fix: exclude non-trackable models from `checkCompletionStatusFor` (fixes #526). --- js/models/adaptModel.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/models/adaptModel.js b/js/models/adaptModel.js index 6e852c97..d6dcb417 100644 --- a/js/models/adaptModel.js +++ b/js/models/adaptModel.js @@ -313,7 +313,7 @@ export default class AdaptModel extends LockingModel { */ checkCompletionStatusFor(completionAttribute = '_isComplete') { let completed = false; - const children = this.getAvailableChildModels(); + const children = this.getAvailableTrackableChildModels(); const requireCompletionOf = this.get('_requireCompletionOf'); const isOptional = this.get('_isOptional'); const isEveryChildOptional = children.every(child => child.get('_isOptional')); @@ -651,6 +651,10 @@ export default class AdaptModel extends LockingModel { }); } + getAvailableTrackableChildModels() { + return this.getAvailableChildModels().filter(child => child.get('_isTrackable') !== false); + } + getParent() { if (this._parentModel) { return this._parentModel;