adaptlearning / adapt-contrib-core

Adapt Framework kernel. Responsible for boot loading, data loading and core APIs.
GNU General Public License v3.0
3 stars 17 forks source link

`checkCompletionStatusFor` doesn't complete if model and its children are optional and trickled #526

Open danielghost opened 5 months ago

danielghost commented 5 months ago

If a model and its children are "_isOptional": true and set to use a trickle button, the model does not mark as _isComplete because the trickle button is not visually available to be completed.

Whilst the JSON is unlikely to be configured this way whilst authoring, it is possible when using a role selector or diagnostic type plugin which can dynamically update _isOptional depending on user choices.

This can be resolved by excluding non-trackable components such as the trickle button from: https://github.com/adaptlearning/adapt-contrib-core/blob/de6fcd9c58ad7ed0d793920b048fcb213bdcc980/js/models/adaptModel.js#L316

It might be useful to create an API method returning these models so it can be used elsewhere as required:

return this.getAvailableChildModels().filter(child => child.get('_isTrackable') !== false);
oliverfoster commented 5 months ago

yes please

oliverfoster commented 4 months ago

If a model and its children are "_isOptional": true and set to use a trickle button, the model does not mark as _isComplete because the trickle button is not visually available to be completed.

Why is the button not visible? Do you have code in trickle that's causing this anomaly?