diff --git a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/__snapshots__/index.test.jsx.snap b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/__snapshots__/index.test.jsx.snap index ea8ae5d6f..52a608aec 100644 --- a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/__snapshots__/index.test.jsx.snap +++ b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/__snapshots__/index.test.jsx.snap @@ -62,7 +62,9 @@ exports[`SettingsWidget snapshot snapshot: renders Settings widget for Advanced
- +
- +
- +
- +
{ problemType === ProblemTypeKeys.ADVANCED && ( @@ -165,7 +169,7 @@ SettingsWidget.propTypes = { defaultSettings: PropTypes.shape({ maxAttempts: PropTypes.number, showanswer: PropTypes.string, - showReseButton: PropTypes.bool, + showResetButton: PropTypes.bool, rerandomize: PropTypes.string, }).isRequired, // eslint-disable-next-line diff --git a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/ResetCard.jsx b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/ResetCard.jsx index a4038863b..3f4d1415e 100644 --- a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/ResetCard.jsx +++ b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/ResetCard.jsx @@ -10,6 +10,7 @@ import { selectors } from '../../../../../../data/redux'; export const ResetCard = ({ showResetButton, + defaultValue, updateSettings, // inject intl, @@ -17,10 +18,11 @@ export const ResetCard = ({ const isLibrary = useSelector(selectors.app.isLibrary); const { setResetTrue, setResetFalse } = resetCardHooks(updateSettings); const advancedSettingsLink = `${useSelector(selectors.app.studioEndpointUrl)}/settings/advanced/${useSelector(selectors.app.learningContextId)}#show_reset_button`; + const currentResetButton = showResetButton !== null ? showResetButton : defaultValue; return ( @@ -37,10 +39,10 @@ export const ResetCard = ({ )} - - @@ -50,6 +52,7 @@ export const ResetCard = ({ ResetCard.propTypes = { showResetButton: PropTypes.bool.isRequired, + defaultValue: PropTypes.bool.isRequired, updateSettings: PropTypes.func.isRequired, // injected intl: intlShape.isRequired, diff --git a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/ShowAnswerCard.jsx b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/ShowAnswerCard.jsx index 5739abbed..2e92667fd 100644 --- a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/ShowAnswerCard.jsx +++ b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/ShowAnswerCard.jsx @@ -26,6 +26,8 @@ export const ShowAnswerCard = ({ showAttempts, } = useAnswerSettings(showAnswer, updateSettings); + const currentShowAnswer = showAnswer.on || defaultValue; + const showAnswerSection = ( <>
@@ -43,7 +45,7 @@ export const ShowAnswerCard = ({ {Object.values(ShowAnswerTypesKeys).map((answerType) => { @@ -79,7 +81,7 @@ export const ShowAnswerCard = ({ return ( {showAnswerSection} diff --git a/src/editors/data/redux/problem/reducers.js b/src/editors/data/redux/problem/reducers.js index 4173cbc9b..c672b85a3 100644 --- a/src/editors/data/redux/problem/reducers.js +++ b/src/editors/data/redux/problem/reducers.js @@ -2,7 +2,7 @@ import _ from 'lodash-es'; import { createSlice } from '@reduxjs/toolkit'; import { indexToLetterMap } from '../../../containers/ProblemEditor/data/OLXParser'; import { StrictDict } from '../../../utils'; -import { ProblemTypeKeys, RichTextProblems, ShowAnswerTypesKeys } from '../../constants/problem'; +import { ProblemTypeKeys, RichTextProblems } from '../../constants/problem'; import { ToleranceTypes } from '../../../containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/Tolerance/constants'; const nextAlphaId = (lastId) => String.fromCharCode(lastId.charCodeAt(0) + 1); @@ -28,10 +28,10 @@ const initialState = { hints: [], timeBetween: 0, showAnswer: { - on: ShowAnswerTypesKeys.FINISHED, + on: '', afterAttempts: 0, }, - showResetButton: false, + showResetButton: null, solutionExplanation: '', tolerance: { value: null,