diff --git a/src/editors/containers/ProblemEditor/components/EditProblemView/hooks.test.js b/src/editors/containers/ProblemEditor/components/EditProblemView/hooks.test.js index 6fa704fc30..bf75e3cfae 100644 --- a/src/editors/containers/ProblemEditor/components/EditProblemView/hooks.test.js +++ b/src/editors/containers/ProblemEditor/components/EditProblemView/hooks.test.js @@ -282,6 +282,7 @@ describe('EditProblemView hooks parseState', () => { const expectedSettings = { max_attempts: '', weight: 1, + rerandomize: null, showanswer: ShowAnswerTypesKeys.AFTER_SOME_NUMBER_OF_ATTEMPTS, show_reset_button: false, submission_wait_seconds: 0, @@ -327,6 +328,9 @@ describe('EditProblemView hooks parseState', () => { }); expect(settings).toEqual({ max_attempts: '', + rerandomize: null, + show_reset_button: false, + showanswer: 'after_attempts', attempts_before_showanswer_button: 0, submission_wait_seconds: 0, weight: 1, diff --git a/src/editors/containers/ProblemEditor/data/ReactStateSettingsParser.js b/src/editors/containers/ProblemEditor/data/ReactStateSettingsParser.js index 49ddac5324..0bc2177849 100644 --- a/src/editors/containers/ProblemEditor/data/ReactStateSettingsParser.js +++ b/src/editors/containers/ProblemEditor/data/ReactStateSettingsParser.js @@ -33,13 +33,13 @@ class ReactStateSettingsParser { settings = popuplateItem(settings, 'number', 'max_attempts', stateSettings.scoring.attempts, defaultSettings?.maxAttempts, true); settings = popuplateItem(settings, 'weight', 'weight', stateSettings.scoring); - settings = popuplateItem(settings, 'on', 'showanswer', stateSettings.showAnswer, defaultSettings?.showanswer); + settings = popuplateItem(settings, 'on', 'showanswer', stateSettings.showAnswer, defaultSettings?.showanswer, true); if (_.includes(numberOfAttemptsChoice, stateSettings.showAnswer.on)) { settings = popuplateItem(settings, 'afterAttempts', 'attempts_before_showanswer_button', stateSettings.showAnswer); } - settings = popuplateItem(settings, 'showResetButton', 'show_reset_button', stateSettings, defaultSettings?.showResetButton); + settings = popuplateItem(settings, 'showResetButton', 'show_reset_button', stateSettings, defaultSettings?.showResetButton, true); settings = popuplateItem(settings, 'timeBetween', 'submission_wait_seconds', stateSettings); - settings = popuplateItem(settings, 'randomization', 'rerandomize', stateSettings, defaultSettings?.rerandomize); + settings = popuplateItem(settings, 'randomization', 'rerandomize', stateSettings, defaultSettings?.rerandomize, true); return settings; } diff --git a/src/editors/containers/ProblemEditor/data/mockData/problemTestData.js b/src/editors/containers/ProblemEditor/data/mockData/problemTestData.js index 65e6d3a896..5829c901cb 100644 --- a/src/editors/containers/ProblemEditor/data/mockData/problemTestData.js +++ b/src/editors/containers/ProblemEditor/data/mockData/problemTestData.js @@ -97,6 +97,7 @@ export const checklistWithFeebackHints = { show_reset_button: true, showanswer: 'after_attempts', attempts_before_showanswer_button: 2, + rerandomize: null, submission_wait_seconds: 3, weight: 2.5, }, @@ -169,6 +170,7 @@ export const dropdownWithFeedbackHints = { show_reset_button: true, showanswer: 'after_attempts', attempts_before_showanswer_button: 2, + rerandomize: null, submission_wait_seconds: 3, weight: 2.5, },