diff --git a/src/pages/ViewPublicationPage/Footer.tsx b/src/pages/ViewPublicationPage/Footer.tsx index f2d2350f..4be27c37 100644 --- a/src/pages/ViewPublicationPage/Footer.tsx +++ b/src/pages/ViewPublicationPage/Footer.tsx @@ -109,6 +109,7 @@ export const Footer = ({ }, [question, answers]); const showResult = (nextQuestion) => { + console.log("Следующий результат будет вот такой" , nextQuestion) if (nextQuestion && quiz?.config.resultInfo.when === "email") { setShowContactForm(true); return; @@ -241,6 +242,7 @@ export const Footer = ({ }; const followNextStep = () => { + console.log(" Я понимаю что нахожусь в линейном опроснике" + linear) if (linear) { setStepNumber((q) => q + 1); const questionIndex = questions.findIndex(({ id }) => id === question.id); diff --git a/src/pages/ViewPublicationPage/ResultForm.tsx b/src/pages/ViewPublicationPage/ResultForm.tsx index ad127e3d..5bc458a0 100644 --- a/src/pages/ViewPublicationPage/ResultForm.tsx +++ b/src/pages/ViewPublicationPage/ResultForm.tsx @@ -33,15 +33,28 @@ export const ResultForm = ({ const theme = useTheme(); const isMobile = useMediaQuery(theme.breakpoints.down(650)); const { questions } = useQuestionsStore(); - const resultQuestion = (questions.find( - (question) => - question.type === "result" && - question.content.rule.parentId === currentQuestion.content.id, - ) || - questions.find( - (question) => - question.type === "result" && question.content.rule.parentId === "line", - )) as AnyTypedQuizQuestion; + + const searchResult = () => { + if (Boolean(quiz?.config.haveRoot)) { + //ищём для ветвления + return (questions.find( + (question) => + question.type === "result" && + question.content.rule.parentId === currentQuestion.content.id, + ) || + questions.find( + (question) => + question.type === "result" && question.content.rule.parentId === "line", + )) as AnyTypedQuizQuestion; + } else { + return questions.find( + (question) => + question.type === "result" && question.content.rule.parentId === "line", + ) as AnyTypedQuizQuestion; + } + } + + const resultQuestion = searchResult() const followNextForm = () => { setShowResultForm(false); @@ -49,6 +62,7 @@ export const ResultForm = ({ }; if (resultQuestion === undefined) return <>; + console.log("Я форма показа резултата и он такой ", resultQuestion) return (