From 6156798e02c82610d87c9c6fc3f5319b761267de Mon Sep 17 00:00:00 2001 From: Raymond Zhou <56318341+rayzhou-bit@users.noreply.github.com> Date: Wed, 15 Feb 2023 09:53:02 -0800 Subject: [PATCH] feat: move solution tag inside problem type tag (#248) --- .../ProblemEditor/data/ReactStateOLXParser.js | 10 ++++++---- .../ProblemEditor/data/mockData/olxTestData.js | 18 ++++++++++-------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/editors/containers/ProblemEditor/data/ReactStateOLXParser.js b/src/editors/containers/ProblemEditor/data/ReactStateOLXParser.js index e818fdcc8..e066797f7 100644 --- a/src/editors/containers/ProblemEditor/data/ReactStateOLXParser.js +++ b/src/editors/containers/ProblemEditor/data/ReactStateOLXParser.js @@ -151,9 +151,9 @@ class ReactStateOLXParser { problem: { [problemType]: { [widget]: widgetObject, + ...solution, }, ...demandhint, - ...solution, }, }; @@ -189,9 +189,9 @@ class ReactStateOLXParser { problem: { [ProblemTypeKeys.TEXTINPUT]: { ...answerObject, + ...solution, }, ...demandhint, - ...solution, }, }; @@ -252,9 +252,11 @@ class ReactStateOLXParser { const problemObject = { problem: { - [ProblemTypeKeys.NUMERIC]: answerObject, + [ProblemTypeKeys.NUMERIC]: { + ...answerObject, + ...solution, + }, ...demandhint, - ...solution, }, }; diff --git a/src/editors/containers/ProblemEditor/data/mockData/olxTestData.js b/src/editors/containers/ProblemEditor/data/mockData/olxTestData.js index 5333bdc58..2bacffc09 100644 --- a/src/editors/containers/ProblemEditor/data/mockData/olxTestData.js +++ b/src/editors/containers/ProblemEditor/data/mockData/olxTestData.js @@ -119,19 +119,21 @@ an incorrect answer You can specify optional You can specify optional feedback for a combination of answers which appears after the specified set of answers is submitted. You can specify optional feedback for one, several, or all answer combinations. + ${solution === 'simple' + ? 'This is a detailed explanation of the solution.' + : ( + ` + Explanation\n + You can form a voltage divider that evenly divides the input + voltage with two identically valued resistors, with the sampled + voltage taken in between the two. + ` + )} You can add an optional hint like this. Problems that have a hint include a hint button, and this text appears the first time learners select the button. If you add more than one hint, a different hint appears each time learners select the hint button. - ${solution === 'simple' ? 'This is a detailed explanation of the solution.' : ( - ` - Explanation\n - You can form a voltage divider that evenly divides the input - voltage with two identically valued resistors, with the sampled - voltage taken in between the two. - ` - )} `, });