From 2bcc6c77bd2be5129b65812b28e7b914780f4c4f Mon Sep 17 00:00:00 2001 From: skeris Date: Sat, 16 Dec 2023 14:58:05 +0300 Subject: [PATCH] UFCKING SHT IT WORKS BUT SHOULLDND --- src/pages/Questions/BranchingMap/CsComponent.tsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/pages/Questions/BranchingMap/CsComponent.tsx b/src/pages/Questions/BranchingMap/CsComponent.tsx index 3df6a30e..d07c5b35 100644 --- a/src/pages/Questions/BranchingMap/CsComponent.tsx +++ b/src/pages/Questions/BranchingMap/CsComponent.tsx @@ -51,7 +51,6 @@ type Popper = { type NodeSingularWithPopper = NodeSingular & { popper: (config: PopperConfig) => Popper; }; - let counter = 0; const stylesheet: Stylesheet[] = [ { @@ -161,7 +160,6 @@ function CsComponent({ }, [modalQuestionTargetContentId]) const addNode = ({ parentNodeContentId, targetNodeContentId }: { parentNodeContentId: string, targetNodeContentId?: string }) => { -console.log('AN', counter++, parentNodeContentId,targetNodeContentId) //запрещаем работу родителя-ребенка если это один и тот же вопрос if (parentNodeContentId === targetNodeContentId) return @@ -171,7 +169,6 @@ console.log('AN', counter++, parentNodeContentId,targetNodeContentId) const parentNodeChildren = cy?.$('edge[source = "' + parentNodeContentId + '"]')?.length //если есть инфо о выбранном вопросе из модалки - берём родителя из инфо модалки. Иначе из значения дропа const targetQuestion = { ...getQuestionByContentId(targetNodeContentId || dragQuestionContentId) } as AnyTypedQuizQuestion -console.log('AN1', targetQuestion, parentNodeContentId,parentNodeChildren) if (Object.keys(targetQuestion).length !== 0 && parentNodeContentId && parentNodeChildren !== undefined) { clearDataAfterAddNode({ parentNodeContentId, targetQuestion, parentNodeChildren }) cy?.data('changed', true) @@ -199,13 +196,13 @@ console.log('AN1', targetQuestion, parentNodeContentId,parentNodeChildren) const clearDataAfterAddNode = ({ parentNodeContentId, targetQuestion, parentNodeChildren }: { parentNodeContentId: string, targetQuestion: AnyTypedQuizQuestion, parentNodeChildren: number }) => { -console.log('AN2', parentNodeContentId,parentNodeChildren,targetQuestion) const parentQuestion = { ...getQuestionByContentId(parentNodeContentId) } as AnyTypedQuizQuestion //смотрим не добавлен ли родителю result. Если да - убираем его. Веточкам result не нужен trashQuestions.forEach((targetQuestion) => { if (targetQuestion.type === "result" && targetQuestion.content.rule.parentId === parentQuestion.content.id) { + console.log('deleteQ', targetQuestion.id) deleteQuestion(targetQuestion.id); } })