Skip to content

Commit

Permalink
fix: reset active answers for single answer problem type (openedx#426)
Browse files Browse the repository at this point in the history
  • Loading branch information
ihor-romaniuk authored and bradenmacdonald committed Aug 27, 2024
1 parent 83fda56 commit f36b218
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 f36b218

Please sign in to comment.