mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
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:
parent
9929edffc0
commit
90a47880cb
1 changed files with 6 additions and 2 deletions
|
|
@ -74,8 +74,12 @@ function TaskQuizObject({ view, assignmentTaskUUID, user_id }: TaskQuizObjectPro
|
||||||
|
|
||||||
const removeOption = (qIndex: number, oIndex: number) => {
|
const removeOption = (qIndex: number, oIndex: number) => {
|
||||||
const updatedQuestions = [...questions];
|
const updatedQuestions = [...questions];
|
||||||
updatedQuestions[qIndex].options.splice(oIndex, 1);
|
if (updatedQuestions[qIndex].options.length > 1) {
|
||||||
setQuestions(updatedQuestions);
|
updatedQuestions[qIndex].options.splice(oIndex, 1);
|
||||||
|
setQuestions(updatedQuestions);
|
||||||
|
} else {
|
||||||
|
toast.error('Cannot delete the last option. At least one option is required.');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const addQuestion = () => {
|
const addQuestion = () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue