Skip to content

Commit 8043df2

Browse files
Fix for ensure that numCorrect is calculated properly when editing new Radio Widgets (#2317)
## Summary: Radio questions set to Multiple Select and "Specify Number Correct" set to true were not actually having the text update accordingly in the Editor. This PR fixes the numCorrect calculation so that new widgets with these values will have numCorrect calculated properly. Issue: LEMS-2921 ## Test plan: - manual testing Author: SonicScrewdriver Reviewers: mark-fitzgerald Required Reviewers: Approved By: mark-fitzgerald Checks: ✅ 8 checks were successful Pull Request URL: #2317
1 parent c1a4dad commit 8043df2

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

.changeset/quiet-clouds-design.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@khanacademy/perseus-editor": patch
3+
---
4+
5+
Bugfix to ensure numCorrect is calculated correctly while in Radio Editor

packages/perseus-editor/src/widgets/radio/editor.tsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ class RadioEditor extends React.Component<RadioEditorProps> {
174174
numCorrect: deriveNumCorrect({
175175
...this.props,
176176
choices,
177+
// When deriving numCorrect, we don't want to pass the current value,
178+
// as it has changed.
179+
numCorrect: undefined,
177180
}),
178181
});
179182
};
@@ -279,7 +282,12 @@ class RadioEditor extends React.Component<RadioEditorProps> {
279282
displayCount,
280283
hasNoneOfTheAbove,
281284
deselectEnabled,
282-
numCorrect: deriveNumCorrect(this.props),
285+
numCorrect: deriveNumCorrect({
286+
...this.props,
287+
// When deriving numCorrect, we don't want to pass the current value,
288+
// as it has changed.
289+
numCorrect: undefined,
290+
}),
283291
};
284292
}
285293

0 commit comments

Comments
 (0)