From 311036fe862984046da538f41381d5911eee9627 Mon Sep 17 00:00:00 2001 From: Carlos-Mesquita Date: Tue, 12 Nov 2024 15:10:23 +0000 Subject: [PATCH] Only hooked up the section state had forgot to plugin into Header's isEvaluationEnabled --- .../ExamEditor/Exercises/Blanks/Letters/index.tsx | 6 ++---- .../ExamEditor/Exercises/Blanks/MultipleChoice/index.tsx | 2 +- .../ExamEditor/Exercises/Blanks/WriteBlankFill/index.tsx | 2 +- src/components/ExamEditor/Exercises/Blanks/index.tsx | 2 +- .../ExamEditor/Exercises/MatchSentences/index.tsx | 2 +- .../ExamEditor/Exercises/MultipleChoice/Underline/index.tsx | 2 +- .../ExamEditor/Exercises/MultipleChoice/Vanilla/index.tsx | 2 +- .../ExamEditor/Exercises/Speaking/InteractiveSpeaking.tsx | 2 +- src/components/ExamEditor/Exercises/Speaking/Speaking1.tsx | 2 +- src/components/ExamEditor/Exercises/Speaking/Speaking2.tsx | 2 +- src/components/ExamEditor/Exercises/WriteBlanks/index.tsx | 2 +- src/components/ExamEditor/Exercises/Writing/index.tsx | 2 +- src/components/ExamEditor/Shared/Header.tsx | 6 +++--- src/stores/examEditor/reducers/index.ts | 1 - src/stores/examEditor/reducers/moduleReducer.ts | 1 - src/stores/examEditor/reducers/sectionReducer.ts | 1 - src/stores/examEditor/reorder/global.ts | 2 -- 17 files changed, 16 insertions(+), 23 deletions(-) diff --git a/src/components/ExamEditor/Exercises/Blanks/Letters/index.tsx b/src/components/ExamEditor/Exercises/Blanks/Letters/index.tsx index fbc85ae0..ef2fff68 100644 --- a/src/components/ExamEditor/Exercises/Blanks/Letters/index.tsx +++ b/src/components/ExamEditor/Exercises/Blanks/Letters/index.tsx @@ -106,7 +106,7 @@ const FillBlanksLetters: React.FC<{ exercise: FillBlanksExercise; sectionId: num onPractice: () => { const updatedExercise = { ...local, - //isPractice: !isPractice, + isPractice: !local.isPractice, }; const newState = { ...section }; newState.exercises = newState.exercises.map((ex) => @@ -242,8 +242,6 @@ const FillBlanksLetters: React.FC<{ exercise: FillBlanksExercise; sectionId: num // eslint-disable-next-line react-hooks/exhaustive-deps }, [answers, blanksState.blanks, blanksState.textMode]) - - useEffect(()=> { setEditingAlert(editing, setAlerts); }, [editing]) @@ -266,7 +264,7 @@ const FillBlanksLetters: React.FC<{ exercise: FillBlanksExercise; sectionId: num onDelete={handleDelete} setEditing={setEditing} onPractice={handlePractice} - isEvaluationEnabled={true}//local.isPractice} + isEvaluationEnabled={!local.isPractice} > <> {!blanksState.textMode && diff --git a/src/components/ExamEditor/Exercises/Blanks/MultipleChoice/index.tsx b/src/components/ExamEditor/Exercises/Blanks/MultipleChoice/index.tsx index b7189404..e83adcbc 100644 --- a/src/components/ExamEditor/Exercises/Blanks/MultipleChoice/index.tsx +++ b/src/components/ExamEditor/Exercises/Blanks/MultipleChoice/index.tsx @@ -266,7 +266,7 @@ const FillBlanksMC: React.FC<{ exercise: FillBlanksExercise; sectionId: number } onPractice={handlePractice} setEditing={setEditing} onBlankRemove={handleBlankRemove} - isEvaluationEnabled={true} + isEvaluationEnabled={!local.isPractice} > {!blanksState.textMode && selectedBlankId && ( diff --git a/src/components/ExamEditor/Exercises/Blanks/WriteBlankFill/index.tsx b/src/components/ExamEditor/Exercises/Blanks/WriteBlankFill/index.tsx index 5de584ae..9acf2018 100644 --- a/src/components/ExamEditor/Exercises/Blanks/WriteBlankFill/index.tsx +++ b/src/components/ExamEditor/Exercises/Blanks/WriteBlankFill/index.tsx @@ -173,7 +173,7 @@ const WriteBlanksFill: React.FC<{ exercise: WriteBlanksExercise; sectionId: numb onDelete={handleDelete} onPractice={handlePractice} setEditing={setEditing} - isEvaluationEnabled={true} + isEvaluationEnabled={!local.isPractice} > {!blanksState.textMode && ( diff --git a/src/components/ExamEditor/Exercises/Blanks/index.tsx b/src/components/ExamEditor/Exercises/Blanks/index.tsx index 3fc349ca..9b728a8b 100644 --- a/src/components/ExamEditor/Exercises/Blanks/index.tsx +++ b/src/components/ExamEditor/Exercises/Blanks/index.tsx @@ -38,7 +38,7 @@ interface Props { onDiscard: () => void; onDelete: () => void; onPractice: () => void; - isEvaluationEnabled: boolean; + isEvaluationEnabled?: boolean; children: ReactNode; } diff --git a/src/components/ExamEditor/Exercises/MatchSentences/index.tsx b/src/components/ExamEditor/Exercises/MatchSentences/index.tsx index 7f57b02f..a2f25889 100644 --- a/src/components/ExamEditor/Exercises/MatchSentences/index.tsx +++ b/src/components/ExamEditor/Exercises/MatchSentences/index.tsx @@ -156,7 +156,7 @@ const MatchSentences: React.FC<{ exercise: MatchSentencesExercise, sectionId: nu handleDelete={handleDelete} handleDiscard={handleDiscard} handlePractice={handlePractice} - isEvaluationEnabled={true} + isEvaluationEnabled={!local.isPractice} > )} - {handlePractice && + {handlePractice &&