From 3ba36e031297ee2ff86305c6f85b48ed01f3772d Mon Sep 17 00:00:00 2001 From: ihor-romaniuk Date: Wed, 29 Nov 2023 14:43:02 +0200 Subject: [PATCH] fix: reset active answers for single answer problem type --- src/editors/data/redux/problem/reducers.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/editors/data/redux/problem/reducers.js b/src/editors/data/redux/problem/reducers.js index 4173cbc9b..2a6d490ee 100644 --- a/src/editors/data/redux/problem/reducers.js +++ b/src/editors/data/redux/problem/reducers.js @@ -60,11 +60,9 @@ const problem = createSlice({ if (obj.id === id) { if (_.has(answer, 'correct') && payload.correct) { correctAnswerCount += 1; - return { ...obj, ...answer }; } - if (_.has(answer, 'correct') && payload.correct === false) { + if (_.has(answer, 'correct') && payload.correct === false && correctAnswerCount > 0) { correctAnswerCount -= 1; - return { ...obj, ...answer }; } return { ...obj, ...answer }; }