From 9e65424ca6db32f515f5570c27e54d7e0b5cffc4 Mon Sep 17 00:00:00 2001 From: Kyle McCormick Date: Thu, 20 Mar 2025 15:49:36 -0400 Subject: [PATCH] refactor: Remove unused defaultToAdvanced and getBetaParsedOLXData (#1753) edx-platform would pass a default_to_advanced flag in through the REST API, depending on the value of a waffle flag. The flag did not actually cause anything to default to advanced. What it actually did was switch from getParsedOLXData to getParsedBetaOLXData. However, getBetaOLXParser was never implemented--it just logs a console warning and return getOLXParser. We remove this unused flag and unused function. The underlying default_to_advanced API flag and the backing waffle flag will be removed from edx-platform in a separate PR. --- .../ProblemEditor/components/SelectTypeModal/hooks.js | 1 - .../components/SelectTypeModal/hooks.test.js | 1 - src/editors/containers/ProblemEditor/data/OLXParser.js | 9 --------- src/editors/data/redux/thunkActions/problem.ts | 7 +------ 4 files changed, 1 insertion(+), 17 deletions(-) diff --git a/src/editors/containers/ProblemEditor/components/SelectTypeModal/hooks.js b/src/editors/containers/ProblemEditor/components/SelectTypeModal/hooks.js index a2165da8c..cc4cc538f 100644 --- a/src/editors/containers/ProblemEditor/components/SelectTypeModal/hooks.js +++ b/src/editors/containers/ProblemEditor/components/SelectTypeModal/hooks.js @@ -23,7 +23,6 @@ export const onSelect = ({ attempts_before_showanswer_button: 0, show_reset_button: null, showanswer: null, - defaultToAdvanced: false, }, defaultSettings: snakeCaseKeys(defaultSettings), }); diff --git a/src/editors/containers/ProblemEditor/components/SelectTypeModal/hooks.test.js b/src/editors/containers/ProblemEditor/components/SelectTypeModal/hooks.test.js index 0c7f987f4..1de51371c 100644 --- a/src/editors/containers/ProblemEditor/components/SelectTypeModal/hooks.test.js +++ b/src/editors/containers/ProblemEditor/components/SelectTypeModal/hooks.test.js @@ -55,7 +55,6 @@ describe('SelectTypeModal hooks', () => { attempts_before_showanswer_button: 0, show_reset_button: null, showanswer: null, - defaultToAdvanced: false, }, defaultSettings: mockDefaultSettings, }); diff --git a/src/editors/containers/ProblemEditor/data/OLXParser.js b/src/editors/containers/ProblemEditor/data/OLXParser.js index e861b5cea..a21d8c05d 100644 --- a/src/editors/containers/ProblemEditor/data/OLXParser.js +++ b/src/editors/containers/ProblemEditor/data/OLXParser.js @@ -753,13 +753,4 @@ export class OLXParser { groupFeedbackList, }; } - - getBetaParsedOLXData() { - /* TODO: Replace olxParser.getParsedOLXData() with new parser function - * and remove console.log() - */ - // eslint-disable-next-line no-console - console.log('Should default to the advanced editor'); - return this.getParsedOLXData(); - } } diff --git a/src/editors/data/redux/thunkActions/problem.ts b/src/editors/data/redux/thunkActions/problem.ts index cd9567d40..5d4c11df6 100644 --- a/src/editors/data/redux/thunkActions/problem.ts +++ b/src/editors/data/redux/thunkActions/problem.ts @@ -34,14 +34,9 @@ export const isBlankProblem = ({ rawOLX }) => { export const getDataFromOlx = ({ rawOLX, rawSettings, defaultSettings }) => { let olxParser; let parsedProblem; - const { default_to_advanced: defaultToAdvanced } = rawSettings; try { olxParser = new OLXParser(rawOLX); - if (defaultToAdvanced) { - parsedProblem = olxParser.getBetaParsedOLXData(); - } else { - parsedProblem = olxParser.getParsedOLXData(); - } + parsedProblem = olxParser.getParsedOLXData(); } catch (error) { // eslint-disable-next-line no-console console.error('The Problem Could Not Be Parsed from OLX. redirecting to Advanced editor.', error);