fix: View next button with multiselect
This commit is contained in:
parent
9aec2d8e86
commit
18750c1699
@ -3,7 +3,10 @@ import { Box, Button, useTheme } from "@mui/material";
|
|||||||
|
|
||||||
import { useQuizViewStore } from "@root/quizView";
|
import { useQuizViewStore } from "@root/quizView";
|
||||||
|
|
||||||
import type { AnyTypedQuizQuestion, QuizQuestionBase } from "../../model/questionTypes/shared";
|
import type {
|
||||||
|
AnyTypedQuizQuestion,
|
||||||
|
QuizQuestionBase,
|
||||||
|
} from "../../model/questionTypes/shared";
|
||||||
import { getQuestionByContentId } from "@root/questions/actions";
|
import { getQuestionByContentId } from "@root/questions/actions";
|
||||||
import { enqueueSnackbar } from "notistack";
|
import { enqueueSnackbar } from "notistack";
|
||||||
|
|
||||||
@ -103,22 +106,34 @@ export const Footer = ({
|
|||||||
|
|
||||||
let readyBeNextQuestion = "";
|
let readyBeNextQuestion = "";
|
||||||
|
|
||||||
(question as QuizQuestionBase).content.rule.main.forEach(({ next, rules }) => {
|
(question as QuizQuestionBase).content.rule.main.forEach(
|
||||||
let longerArray = Math.max(
|
({ next, rules }) => {
|
||||||
rules[0].answers.length,
|
let longerArray = Math.max(
|
||||||
[answer?.answer].length
|
rules[0].answers.length,
|
||||||
);
|
answer?.answer && Array.isArray(answer?.answer)
|
||||||
|
? answer?.answer.length
|
||||||
|
: [answer?.answer].length
|
||||||
|
);
|
||||||
|
|
||||||
for (
|
for (
|
||||||
var i = 0;
|
var i = 0;
|
||||||
i < longerArray;
|
i < longerArray;
|
||||||
i++ // Цикл по всем элементам бОльшего массива
|
i++ // Цикл по всем элементам бОльшего массива
|
||||||
) {
|
) {
|
||||||
if (rules[0].answers[i] === answer?.answer) {
|
if (Array.isArray(answer?.answer)) {
|
||||||
readyBeNextQuestion = next; // Если хоть один элемент отличается, массивы не равны
|
if (answer?.answer.find((item) => item === rules[0].answers[i])) {
|
||||||
|
readyBeNextQuestion = next; // Если хоть один элемент отличается, массивы не равны
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rules[0].answers[i] === answer?.answer) {
|
||||||
|
readyBeNextQuestion = next; // Если хоть один элемент отличается, массивы не равны
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
|
|
||||||
return readyBeNextQuestion;
|
return readyBeNextQuestion;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user