fix: No way to add an answer for question after deleting all answers for quizzes on admin assignment page #359

This commit is contained in:
swve 2024-11-28 22:25:19 +01:00
parent 9929edffc0
commit 90a47880cb

View file

@ -74,8 +74,12 @@ function TaskQuizObject({ view, assignmentTaskUUID, user_id }: TaskQuizObjectPro
const removeOption = (qIndex: number, oIndex: number) => {
const updatedQuestions = [...questions];
if (updatedQuestions[qIndex].options.length > 1) {
updatedQuestions[qIndex].options.splice(oIndex, 1);
setQuestions(updatedQuestions);
} else {
toast.error('Cannot delete the last option. At least one option is required.');
}
};
const addQuestion = () => {