Skip to content

Commit

Permalink
fix: reset active answers for single answer problem type
Browse files Browse the repository at this point in the history
  • Loading branch information
ihor-romaniuk committed Nov 29, 2023
1 parent c0bc54a commit 3ba36e0
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/editors/data/redux/problem/reducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
}
Expand Down

0 comments on commit 3ba36e0

Please sign in to comment.