Merge branch 'fixes' into dev

This commit is contained in:
Nastya 2024-01-05 15:01:53 +03:00
commit 70772197bb
2 changed files with 25 additions and 9 deletions

@ -109,6 +109,7 @@ export const Footer = ({
}, [question, answers]); }, [question, answers]);
const showResult = (nextQuestion) => { const showResult = (nextQuestion) => {
console.log("Следующий результат будет вот такой" , nextQuestion)
if (nextQuestion && quiz?.config.resultInfo.when === "email") { if (nextQuestion && quiz?.config.resultInfo.when === "email") {
setShowContactForm(true); setShowContactForm(true);
return; return;
@ -241,6 +242,7 @@ export const Footer = ({
}; };
const followNextStep = () => { const followNextStep = () => {
console.log(" Я понимаю что нахожусь в линейном опроснике" + linear)
if (linear) { if (linear) {
setStepNumber((q) => q + 1); setStepNumber((q) => q + 1);
const questionIndex = questions.findIndex(({ id }) => id === question.id); const questionIndex = questions.findIndex(({ id }) => id === question.id);

@ -33,7 +33,11 @@ export const ResultForm = ({
const theme = useTheme(); const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down(650)); const isMobile = useMediaQuery(theme.breakpoints.down(650));
const { questions } = useQuestionsStore(); const { questions } = useQuestionsStore();
const resultQuestion = (questions.find(
const searchResult = () => {
if (Boolean(quiz?.config.haveRoot)) {
//ищём для ветвления
return (questions.find(
(question) => (question) =>
question.type === "result" && question.type === "result" &&
question.content.rule.parentId === currentQuestion.content.id, question.content.rule.parentId === currentQuestion.content.id,
@ -42,6 +46,15 @@ export const ResultForm = ({
(question) => (question) =>
question.type === "result" && question.content.rule.parentId === "line", question.type === "result" && question.content.rule.parentId === "line",
)) as AnyTypedQuizQuestion; )) as AnyTypedQuizQuestion;
} else {
return questions.find(
(question) =>
question.type === "result" && question.content.rule.parentId === "line",
) as AnyTypedQuizQuestion;
}
}
const resultQuestion = searchResult()
const followNextForm = () => { const followNextForm = () => {
setShowResultForm(false); setShowResultForm(false);
@ -49,6 +62,7 @@ export const ResultForm = ({
}; };
if (resultQuestion === undefined) return <></>; if (resultQuestion === undefined) return <></>;
console.log("Я форма показа резултата и он такой ", resultQuestion)
return ( return (
<Box <Box
sx={{ sx={{