Skip to content

Breaking: Upgrade to version 2 of scoring (fixes #21)#22

Open
oliverfoster wants to merge 13 commits intomasterfrom
issue/21
Open

Breaking: Upgrade to version 2 of scoring (fixes #21)#22
oliverfoster wants to merge 13 commits intomasterfrom
issue/21

Conversation

@oliverfoster
Copy link
Copy Markdown
Member

@oliverfoster oliverfoster commented Jul 30, 2025

fixes #21

requires adaptlearning/adapt-contrib-scoring#30

Breaking

  • Use State to help save and restore to offline storage
  • Switched to use LifecycleSet integrated lifecycle functions
  • Isolate compatibility layer with adapt-contrib-assessment plugins
  • Changed from rawModels and models to models and availableModels where relevant
  • Added some jsdocs

@oliverfoster oliverfoster moved this from New to Needs Reviewing in adapt_framework: The TODO Board Jul 30, 2025
Resolved an issue where a second assessment attempt failed to trigger completion. This occurred because `Attempt.isInSession` was reset when `LifecycleRenderer` called `onStart` after `onVisit` following an assessment reset.

Moved `isInSession` logic into `AssessmentSet`, as it represents navigation state rather than attempt-specific state.

Also removed an unnecessary condition in the Attempts `reset` method that incorrectly set `_history` to an `Attempt`, which was unreachable due to required config.
Comment thread js/AssessmentSet.js
Comment on lines +272 to +278
async onRestore() {
const restored = this.state.restore();
if (!restored) return false;
triggerCompatibleRestored(this);
await super.onRestore();
return true;
}
Copy link
Copy Markdown
Contributor

@danielghost danielghost Mar 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous assessment versions triggered the relevant events regardless of the restoration state. It doesn't look like this is needed based on the listeners in adaptlearning plugins. Should we at least make triggerCompatibleRestored fire regardless for backwards compatibility?

Should https://github.com/adaptlearning/adapt-contrib-scoring/blob/b93a07662792526ddf5095848a05b2b045c1d77a/js/ScoringSet.js#L371-L372 execute regardless of restored state? I don't think it matters as onUpdate will not trigger completion at this point.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. If that's how it was.

… may not be consistent based on conditional content such as branching or banking. This is also needed for the changes made in 20dcb0b.

Fixed potential issues due to the incorrect logical operators.
Comment thread js/AssessmentSet.js
async onVisit() {
this._isInSession = true;
if (this.attempt.isInProgress) return;
if (this._isInReset) return;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it actually possible for the set to already be in a reset phase at this point with the way the LifeCycleRenderer works?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know.

Is it not code brought over from the assessment results "try again" button, where the assessment page refreshes to rerender the assessment from the start?

… with super class methods not always being called for `onInit` and `onRestore`. Updated to latest Lifecycle logic to distinguish between first attempt and reset attempts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Needs Reviewing

Development

Successfully merging this pull request may close these issues.

Upgrade to version 2 of scoring

2 participants