-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
checkCompletionStatusFor
completes when all child models are unavailable
#448
Comments
It's not so much an issue with Are we saying that an "empty" parent should not automatically complete? Whereas an empty parent does currently complete. adapt-contrib-core/js/models/adaptModel.js Lines 314 to 317 in 0d126f4
Something like: checkCompletionStatusFor(completionAttribute = '_isComplete') {
let completed = false;
const children = this.getAvailableChildModels();
const hasNoAvailableChildren = (!children.length);
if (hasNoAvailableChildren) return Adapt.checkedCompletion();
const requireCompletionOf = this.get('_requireCompletionOf'); |
Yes, the problem can be seen when using a plugin which modifies the available children, like a role selector. If a user switches roles, the models which previously had all its children set to Preventing completion on models without available children solves this issue, but it can cause a potential problem with trickle where the trickle button is added to an optional last block, which would have previously not been added as the block would be set to completed. Setting |
As
Array.every
returns true when invoked on an empty array, the following lines will set models to_isComplete: true
if all child models are unavailable (_isAvailable: false
):https://github.com/adaptlearning/adapt-contrib-core/blob/master/js/models/adaptModel.js#L319
https://github.com/adaptlearning/adapt-contrib-core/blob/master/js/models/adaptModel.js#L326-L328
The text was updated successfully, but these errors were encountered: