From 6b5bf705c67b54cf243e0109fe9a3f7aee2985ac Mon Sep 17 00:00:00 2001 From: Nastya Date: Fri, 5 Jan 2024 15:00:36 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D0=BB=D0=B8=D0=BD=D0=B5?= =?UTF-8?q?=D0=B9=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=BE=D0=BF=D1=80=D0=BE=D1=81?= =?UTF-8?q?=D0=BD=D0=B8=D0=BA=D0=B0=20=D1=81=D1=80=D0=B0=D0=B7=D1=83=20?= =?UTF-8?q?=D0=B8=D1=89=D0=B5=D1=82=D1=81=D1=8F=20=D0=BB=D0=B8=D0=BD=D0=B5?= =?UTF-8?q?=D0=B9=D0=BD=D1=8B=D0=B9=20=D1=80=D0=B5=D0=B7=D1=83=D0=BB=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/ViewPublicationPage/Footer.tsx | 2 ++ src/pages/ViewPublicationPage/ResultForm.tsx | 32 ++++++++++++++------ 2 files changed, 25 insertions(+), 9 deletions(-) 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 223e0e66..b97ee917 100644 --- a/src/pages/ViewPublicationPage/ResultForm.tsx +++ b/src/pages/ViewPublicationPage/ResultForm.tsx @@ -25,15 +25,28 @@ export const ResultForm = ({ const quiz = useCurrentQuiz(); const mode = modes; 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); @@ -41,6 +54,7 @@ export const ResultForm = ({ }; if (resultQuestion === undefined) return <>; + console.log("Я форма показа резултата и он такой ", resultQuestion) return (