This commit is contained in:
Nastya 2023-12-04 10:50:55 +03:00
parent 525977609d
commit 25ce62509b
2 changed files with 20 additions and 16 deletions

@ -684,10 +684,14 @@ if (e.cy().data('firstNode') !== 'root') {
}} }}
/> />
<button onClick={() => { <button onClick={() => {
console.log("ELEMENTS____________________________") console.log("NODES____________________________")
cyRef.current?.elements().forEach((ele:any) => { cyRef.current?.elements().forEach((ele:any) => {
console.log(ele.data()) console.log(ele.data())
}) })
}}>nodes</button>
<button onClick={() => {
console.log("ELEMENTS____________________________")
console.log(questions)
}}>elements</button> }}>elements</button>
</> </>
); );

@ -38,20 +38,20 @@ export default function BranchingQuestions() {
useLayoutEffect(() => { useLayoutEffect(() => {
if (parentQuestion.content.rule.main.length === 0) updateQuestion(parentQuestion.id, question => question.content.rule.main.push({ if (parentQuestion.content.rule.main.length === 0) updateQuestion(parentQuestion.id, question => question.content.rule.main.push({
next: targetQuestion.content.id, next: targetQuestion.content.id,
or: true, or: true,
rules: [{ rules: [{
question: parentQuestion.content.id, question: parentQuestion.content.id,
answers: [] answers: []
}] }]
})) }))
}) })
if (targetQuestion === null || parentQuestion === null) { if (targetQuestion === null || parentQuestion === null) {
console.log(openedModalSettingsId) console.log(openedModalSettingsId)
enqueueSnackbar("Невозможно найти данные ветвления для этого вопроса") enqueueSnackbar("Невозможно найти данные ветвления для этого вопроса")
return <></> return <></>
} }
@ -59,7 +59,7 @@ export default function BranchingQuestions() {
const saveData = () => { const saveData = () => {
console.log(parentQuestion) console.log(parentQuestion)
if (parentQuestion !== null) { if (parentQuestion !== null) {
updateQuestion(parentQuestion.content.id, question => question.content = parentQuestion.content) updateQuestion(parentQuestion.content.id, question => question.content = parentQuestion.content)
} }
handleClose() handleClose()
@ -148,11 +148,11 @@ export default function BranchingQuestions() {
marginBottom: "10px", marginBottom: "10px",
cursor: "pointer" cursor: "pointer"
}} }}
onClick={() => { onClick={() => {
const mutate = JSON.parse(JSON.stringify(parentQuestion)) const mutate = JSON.parse(JSON.stringify(parentQuestion))
mutate.content.rule.main.push(createBranchingRuleMain(targetQuestion.content.id, parentQuestion.content.id)) mutate.content.rule.main.push(createBranchingRuleMain(targetQuestion.content.id, parentQuestion.content.id))
setParentQuestion(mutate) setParentQuestion(mutate)
}} }}
> >
Добавить условие Добавить условие
</Link> </Link>