feat: unselect multiple choices type multi->single (#181)

This commit is contained in:
Kristin Aoki
2023-01-10 13:25:19 -05:00
committed by GitHub
parent 880d205cbb
commit af4cd55390
16 changed files with 429 additions and 13 deletions

View File

@@ -35,7 +35,14 @@ export const prepareEditorRef = () => {
return { editorRef, refReady, setEditorRef };
};
export const initializeAnswerContainer = (problemType) => {
export const initializeAnswerContainer = ({ answers, problemType, updateField }) => {
const hasSingleAnswer = problemType === ProblemTypeKeys.DROPDOWN || problemType === ProblemTypeKeys.SINGLESELECT;
let answerCount = 0;
answers.forEach(answer => {
if (answer.correct) {
answerCount += 1;
}
});
updateField({ correctAnswerCount: answerCount });
return { hasSingleAnswer };
};