You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In earlier versions of Adapt, if the learner changed language when _languagePicker._restoreStateOnLanguageChange: true, the responses the learner gave to questions was restored.
Tested as working v5.1.0 - but I think should still work OK up until v5.7.0, at which point it looks like #2846 broke it
Your environment
FW v5.7.1
languagePicker v4.1.1
Steps to reproduce
Setup a course with multiple languages. In config.json, set _languagePicker._restoreStateOnLanguageChange: true. Build & run the course, answer a question, change languages.
Expected behaviour
The answer you gave in the original language should be restored
Actual behaviour
The question shows as completed but the answer is not restored
Findings
It looks like the issue was introduced by the addition of this check of Adapt.get('_isStarted') - which causes restoreUserAnswers to be invoked pretty much immediately when switching language, instead of waiting for the 'adapt:initialize' to be triggered.
The addition of the check for Adapt.get('_isStarted') causes the execution order to change so that restoreUserAnswers now runs before the 'app:dataLoaded' event is triggered - which means that restoreUserAnswers won't actually do anything because _isSubmitted is still set to false - on account of how languagePickerModel.setTrackableState now doesn't restore the state of _isSubmitted until afterrestoreUserAnswers has run.
Commenting out the check for Adapt.get('_isStarted') so that restoreUserAnswers doesn't run until the 'adapt:initialize' event is triggered certainly fixes this issue for me - I just wasn't sure of potential knock-on impact of changing this... @oliverfoster could do with your thoughts on this if you have a moment?
The text was updated successfully, but these errors were encountered:
This check is so that you can create new models after the initial data loading process.
Such as with cloning. The alternative would be to set _isStarted to false when switching languages.
This check is so that you can create new models after the initial data loading process.
Such as with cloning. The alternative would be to set _isStarted to false when switching languages.
Ah OK - no problem I'll try something along those lines next week.
moloko
changed the title
multilanguage course: not restoring user's answers to questions on language change
multilanguage course: not restoring learners' answers to questions on language change
Dec 7, 2020
Subject of the issue/enhancement/features
In earlier versions of Adapt, if the learner changed language when
_languagePicker._restoreStateOnLanguageChange: true
, the responses the learner gave to questions was restored.Tested as working v5.1.0 - but I think should still work OK up until v5.7.0, at which point it looks like #2846 broke it
Your environment
Steps to reproduce
Setup a course with multiple languages. In config.json, set
_languagePicker._restoreStateOnLanguageChange: true
. Build & run the course, answer a question, change languages.Expected behaviour
The answer you gave in the original language should be restored
Actual behaviour
The question shows as completed but the answer is not restored
Findings
It looks like the issue was introduced by the addition of this check of
Adapt.get('_isStarted')
- which causesrestoreUserAnswers
to be invoked pretty much immediately when switching language, instead of waiting for the'adapt:initialize'
to be triggered.(In Adapt v5.6.1, this particular bit of code was in questionModel.js and did not contain the same check for
Adapt.get('_isStarted')
.)The addition of the check for
Adapt.get('_isStarted')
causes the execution order to change so thatrestoreUserAnswers
now runs before the'app:dataLoaded'
event is triggered - which means that restoreUserAnswers won't actually do anything because_isSubmitted
is still set tofalse
- on account of howlanguagePickerModel.setTrackableState
now doesn't restore the state of_isSubmitted
until afterrestoreUserAnswers
has run.Commenting out the check for
Adapt.get('_isStarted')
so thatrestoreUserAnswers
doesn't run until the'adapt:initialize'
event is triggered certainly fixes this issue for me - I just wasn't sure of potential knock-on impact of changing this... @oliverfoster could do with your thoughts on this if you have a moment?The text was updated successfully, but these errors were encountered: