Skip to content
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

First model remains _isLocked when content order is randomised #223

Closed
danielghost opened this issue May 23, 2024 · 4 comments · Fixed by #224
Closed

First model remains _isLocked when content order is randomised #223

danielghost opened this issue May 23, 2024 · 4 comments · Fixed by #224
Assignees

Comments

@danielghost
Copy link
Contributor

Since https://github.com/adaptlearning/adapt-contrib-trickle/releases/tag/v5.1.0, if page content is randomised (e.g. via an assessment) and the first component displayed isn't the first in the natural model structure order, that component remains _isLocked for the remainder of the course session. The model therefore appears locked in the pageLevelProgress despite trickle itself unlocking to the next model. All subsequent models work as expected.

@oliverfoster
Copy link
Member

oliverfoster commented May 24, 2024

I have a feeling it's just that the locks aren't recalculated after the assessment reworks its children.

https://github.com/adaptlearning/adapt-contrib-assessment/blob/2dccd75e3e7ee563ed02958b9ef48766d338b072/js/adapt-assessmentArticleModel.js#L186

export function applyLocks() {

@danielghost
Copy link
Contributor Author

applyLocks does seem to be called following an assessment amending the children. Turns out this is actually the same issue as #164. The example code in #164 (comment) seems to resolve the issue. I will create a PR for review.

@oliverfoster
Copy link
Member

oliverfoster commented May 24, 2024

That makes sense. An extra execution to cover the immediate descendants, instead of just the ancestor's next siblings:

locks[id] = locks[id] || false;
// Apply lock to all subsequent models
const subsequentLockingModels = _getAncestorNextSiblings(siteModel);

// Cascade inherited locks through the hierarchyd
model.getAllDescendantModels().forEach(descendant => {
const descendantId = descendant.get('_id');
modelsById[descendantId] = descendant;
locks[descendantId] = locks[id];
});

danielghost added a commit that referenced this issue May 24, 2024
…orrect locking for dynamic children order (fixes #223, fixes #164).
@danielghost danielghost self-assigned this May 24, 2024
@danielghost danielghost moved this from New to Needs Reviewing in adapt_framework: The TODO Board May 24, 2024
oliverfoster pushed a commit that referenced this issue Jun 11, 2024
…orrect locking for dynamic children order (fixes #223, fixes #164). (#224)
@github-project-automation github-project-automation bot moved this from Needs Reviewing to Recently Released in adapt_framework: The TODO Board Jun 11, 2024
github-actions bot pushed a commit that referenced this issue Jun 11, 2024
## [7.4.1](v7.4.0...v7.4.1) (2024-06-11)

### Fix

* Calculate locking on all descendant models to fix issue with incorrect locking for dynamic children order (fixes #223, fixes #164). (#224) ([8276448](8276448)), closes [#223](#223) [#164](#164) [#224](#224)
Copy link

🎉 This issue has been resolved in version 7.4.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants