diff --git a/src/components/ExamEditor/Exercises/Blanks/MultipleChoice/index.tsx b/src/components/ExamEditor/Exercises/Blanks/MultipleChoice/index.tsx index f5343b70..b7189404 100644 --- a/src/components/ExamEditor/Exercises/Blanks/MultipleChoice/index.tsx +++ b/src/components/ExamEditor/Exercises/Blanks/MultipleChoice/index.tsx @@ -102,7 +102,7 @@ const FillBlanksMC: React.FC<{ exercise: FillBlanksExercise; sectionId: number } onPractice: () => { const updatedExercise = { ...local, - //isPractice: !isPractice, + isPractice: !local.isPractice }; const newState = { ...section }; newState.exercises = newState.exercises.map((ex) => diff --git a/src/components/ExamEditor/Exercises/Blanks/WriteBlankFill/index.tsx b/src/components/ExamEditor/Exercises/Blanks/WriteBlankFill/index.tsx index bbbeea41..5de584ae 100644 --- a/src/components/ExamEditor/Exercises/Blanks/WriteBlankFill/index.tsx +++ b/src/components/ExamEditor/Exercises/Blanks/WriteBlankFill/index.tsx @@ -73,7 +73,7 @@ const WriteBlanksFill: React.FC<{ exercise: WriteBlanksExercise; sectionId: numb onPractice: () => { const updatedExercise = { ...local, - isPractice: true, + isPractice: !local.isPractice }; const newState = { ...section }; newState.exercises = newState.exercises.map((ex) => diff --git a/src/components/ExamEditor/Exercises/MatchSentences/index.tsx b/src/components/ExamEditor/Exercises/MatchSentences/index.tsx index b8b372e2..7f57b02f 100644 --- a/src/components/ExamEditor/Exercises/MatchSentences/index.tsx +++ b/src/components/ExamEditor/Exercises/MatchSentences/index.tsx @@ -70,7 +70,7 @@ const MatchSentences: React.FC<{ exercise: MatchSentencesExercise, sectionId: nu onPractice: () => { const updatedExercise = { ...local, - //isPractice: !isPractice, + isPractice: !local.isPractice }; const newState = { ...section }; newState.exercises = newState.exercises.map((ex) => diff --git a/src/components/ExamEditor/Exercises/MultipleChoice/Underline/index.tsx b/src/components/ExamEditor/Exercises/MultipleChoice/Underline/index.tsx index 7cb8e2c8..93f7b9da 100644 --- a/src/components/ExamEditor/Exercises/MultipleChoice/Underline/index.tsx +++ b/src/components/ExamEditor/Exercises/MultipleChoice/Underline/index.tsx @@ -101,7 +101,7 @@ const UnderlineMultipleChoice: React.FC<{exercise: MultipleChoiceExercise, secti onPractice: () => { const updatedExercise = { ...local, - //isPractice: !isPractice, + isPractice: !local.isPractice }; const newState = { ...section }; newState.exercises = newState.exercises.map((ex) => diff --git a/src/components/ExamEditor/Exercises/MultipleChoice/Vanilla/index.tsx b/src/components/ExamEditor/Exercises/MultipleChoice/Vanilla/index.tsx index ba84e453..e9e8b1b7 100644 --- a/src/components/ExamEditor/Exercises/MultipleChoice/Vanilla/index.tsx +++ b/src/components/ExamEditor/Exercises/MultipleChoice/Vanilla/index.tsx @@ -180,7 +180,7 @@ const MultipleChoice: React.FC = ({ exercise, sectionId, op onPractice: () => { const updatedExercise = { ...local, - //isPractice: !isPractice, + isPractice: !local.isPractice }; const newState = { ...section }; newState.exercises = newState.exercises.map((ex) => diff --git a/src/components/ExamEditor/Exercises/Speaking/InteractiveSpeaking.tsx b/src/components/ExamEditor/Exercises/Speaking/InteractiveSpeaking.tsx index 051e2218..60833bf7 100644 --- a/src/components/ExamEditor/Exercises/Speaking/InteractiveSpeaking.tsx +++ b/src/components/ExamEditor/Exercises/Speaking/InteractiveSpeaking.tsx @@ -53,7 +53,7 @@ const InteractiveSpeaking: React.FC = ({ sectionId, exercise, module = "s onPractice: () => { const updatedExercise = { ...state, - //isPractice: !isPractice, + isPractice: !local.isPractice }; dispatch({ type: 'UPDATE_SECTION_STATE', payload: { sectionId, update: updatedExercise, module: module } }); }, diff --git a/src/components/ExamEditor/Exercises/Speaking/Speaking1.tsx b/src/components/ExamEditor/Exercises/Speaking/Speaking1.tsx index a8d37013..951b0f54 100644 --- a/src/components/ExamEditor/Exercises/Speaking/Speaking1.tsx +++ b/src/components/ExamEditor/Exercises/Speaking/Speaking1.tsx @@ -65,7 +65,7 @@ const Speaking1: React.FC = ({ sectionId, exercise, module = "speaking" } onPractice: () => { const updatedExercise = { ...state, - //isPractice: !isPractice, + isPractice: !local.isPractice }; dispatch({ type: 'UPDATE_SECTION_STATE', payload: { sectionId, update: updatedExercise, module: module } }); }, diff --git a/src/components/ExamEditor/Exercises/Speaking/Speaking2.tsx b/src/components/ExamEditor/Exercises/Speaking/Speaking2.tsx index 7c333f57..1d4d3456 100644 --- a/src/components/ExamEditor/Exercises/Speaking/Speaking2.tsx +++ b/src/components/ExamEditor/Exercises/Speaking/Speaking2.tsx @@ -52,7 +52,7 @@ const Speaking2: React.FC = ({ sectionId, exercise, module = "speaking" } onPractice: () => { const updatedExercise = { ...state, - //isPractice: !isPractice, + isPractice: !local.isPractice }; dispatch({ type: 'UPDATE_SECTION_STATE', payload: { sectionId, update: updatedExercise, module: module } }); }, diff --git a/src/components/ExamEditor/Exercises/TrueFalse/index.tsx b/src/components/ExamEditor/Exercises/TrueFalse/index.tsx index f38c4e3a..a5dc9bc1 100644 --- a/src/components/ExamEditor/Exercises/TrueFalse/index.tsx +++ b/src/components/ExamEditor/Exercises/TrueFalse/index.tsx @@ -107,7 +107,7 @@ const TrueFalse: React.FC<{ exercise: TrueFalseExercise, sectionId: number }> = onPractice: () => { const updatedExercise = { ...local, - //isPractice: !isPractice, + isPractice: !local.isPractice }; const newState = { ...section }; newState.exercises = newState.exercises.map((ex) => diff --git a/src/components/ExamEditor/Exercises/WriteBlanks/index.tsx b/src/components/ExamEditor/Exercises/WriteBlanks/index.tsx index ddde2363..738c78f2 100644 --- a/src/components/ExamEditor/Exercises/WriteBlanks/index.tsx +++ b/src/components/ExamEditor/Exercises/WriteBlanks/index.tsx @@ -79,7 +79,7 @@ const WriteBlanks: React.FC<{ sectionId: number; exercise: WriteBlanksExercise; onPractice: () => { const updatedExercise = { ...local, - //isPractice: !isPractice, + isPractice: !local.isPractice }; const newState = { ...section }; newState.exercises = newState.exercises.map((ex) => diff --git a/src/components/ExamEditor/Exercises/WriteBlanksForm/index.tsx b/src/components/ExamEditor/Exercises/WriteBlanksForm/index.tsx index 89f6df33..92271aad 100644 --- a/src/components/ExamEditor/Exercises/WriteBlanksForm/index.tsx +++ b/src/components/ExamEditor/Exercises/WriteBlanksForm/index.tsx @@ -65,7 +65,7 @@ const WriteBlanksForm: React.FC<{ sectionId: number; exercise: WriteBlanksExerci onPractice: () => { const updatedExercise = { ...local, - //isPractice: !isPractice, + isPractice: !local.isPractice }; const newState = { ...section }; newState.exercises = newState.exercises.map((ex) => diff --git a/src/components/ExamEditor/Exercises/Writing/index.tsx b/src/components/ExamEditor/Exercises/Writing/index.tsx index 9a296fce..b381f666 100644 --- a/src/components/ExamEditor/Exercises/Writing/index.tsx +++ b/src/components/ExamEditor/Exercises/Writing/index.tsx @@ -63,11 +63,10 @@ const Writing: React.FC = ({ sectionId, exercise, module, index }) => { }); } }, - onEdit: ()=> {}, onPractice: () => { const newState = { ...state, - //isPractice: !isPractice, + isPractice: !local.isPractice }; dispatch({ type: 'UPDATE_SECTION_STATE', payload: { sectionId, update: newState, module: currentModule } }); } diff --git a/src/components/ExamEditor/Hooks/useSettingsState.tsx b/src/components/ExamEditor/Hooks/useSettingsState.tsx index bec4d421..83dd4487 100644 --- a/src/components/ExamEditor/Hooks/useSettingsState.tsx +++ b/src/components/ExamEditor/Hooks/useSettingsState.tsx @@ -45,6 +45,7 @@ const useSettingsState = ( }, 1000); return debouncedFn; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [dispatch, sectionId]); useEffect(() => { diff --git a/src/components/ExamEditor/SectionRenderer/SectionExercises/index.tsx b/src/components/ExamEditor/SectionRenderer/SectionExercises/index.tsx index 3c82be6c..abed5be5 100644 --- a/src/components/ExamEditor/SectionRenderer/SectionExercises/index.tsx +++ b/src/components/ExamEditor/SectionRenderer/SectionExercises/index.tsx @@ -105,6 +105,7 @@ const SectionExercises: React.FC<{ sectionId: number; }> = ({ sectionId }) => { updates.forEach(update => dispatch(update)); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [levelGenResults, sectionState, levelGenerating, sectionId, currentModule]); useEffect(() => { @@ -152,6 +153,7 @@ const SectionExercises: React.FC<{ sectionId: number; }> = ({ sectionId }) => { updates.forEach(update => dispatch(update)); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [levelGenResults, sectionState, levelGenerating, sectionId, currentModule]);