Merge branch 'branching' of penahub.gitlab.yandexcloud.net:frontend/squiz into branching
This commit is contained in:
commit
7029c86f19
@ -1,7 +1,7 @@
|
||||
import { MessageIcon } from "@icons/messagIcon";
|
||||
import { PointsIcon } from "@icons/questionsPage/PointsIcon";
|
||||
import { DeleteIcon } from "@icons/questionsPage/deleteIcon";
|
||||
import TextareaAutosize from "@mui/base/TextareaAutosize";
|
||||
import { TextareaAutosize } from "@mui/base/TextareaAutosize";
|
||||
import {
|
||||
Box,
|
||||
FormControl,
|
||||
|
||||
@ -331,16 +331,17 @@ console.log(e.cy.data('firstNode'),"SKEEER",e.cy.data('changed'))
|
||||
while (queue.length) {
|
||||
const task = queue.pop()
|
||||
task.task.data('layer', task.layer)
|
||||
console.log('SAMSHIIIIT',task.layer,task.task.data().layer)
|
||||
task.task.removeData('subtreeWidth')
|
||||
const children = e.cy().edges(`[source="${task.task.id()}"]`).targets()
|
||||
task.task.data('children', children.length)
|
||||
if (children.length !== 0) {
|
||||
children.forEach(n => queue.push({ task: n, layer: task.layer + 1 }))
|
||||
}
|
||||
}
|
||||
queue.push({ parent: e, children: children.targets() })
|
||||
queue.push({ parent: e, children: children })
|
||||
while (queue.length) {
|
||||
const task = queue.pop()
|
||||
console.log('WIIIING',task.parent.data(),task.children.length)
|
||||
if (task.children.length === 0) {
|
||||
task.parent.data('subtreeWidth', task.parent.height())
|
||||
continue
|
||||
@ -363,7 +364,6 @@ console.log(e.cy.data('firstNode'),"SKEEER",e.cy.data('changed'))
|
||||
e.data('oldPos', pos)
|
||||
return pos
|
||||
} else {
|
||||
console.log(e.cy().data('firstNode'))
|
||||
if (e.cy().data('firstNode') !== 'root') {
|
||||
e.cy().data('firstNode','nonroot')
|
||||
return {x:0,y:0}
|
||||
|
||||
@ -37,6 +37,7 @@ export default function BranchingQuestions() {
|
||||
console.log(parentQuestion)
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (parentQuestion === null) return
|
||||
if (parentQuestion.content.rule.main.length === 0) updateQuestion(parentQuestion.id, question => question.content.rule.main.push({
|
||||
next: targetQuestion.content.id,
|
||||
or: true,
|
||||
|
||||
@ -148,7 +148,7 @@ const SelectorType = ({ parentQuestion, targetQuestion, ruleIndex, setParentQues
|
||||
</Box>
|
||||
<Select
|
||||
multiple
|
||||
value={parentQuestion.content.rule.main[ruleIndex].rules[0].answers || []}
|
||||
value={parentQuestion.content?.rule?.main[ruleIndex]?.rules[0]?.answers || []}
|
||||
onChange={(event: SelectChangeEvent) => {
|
||||
|
||||
let newParentQuestion = JSON.parse(JSON.stringify(parentQuestion))
|
||||
@ -518,4 +518,4 @@ const RatingInputsType = ({ parentQuestion, targetQuestion, ruleIndex, setParent
|
||||
// default: ID string
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
@ -37,7 +37,10 @@ export const BranchingQuestionsModal = ({ openedModalQuestions, setOpenedModalQu
|
||||
}}
|
||||
>
|
||||
<Box sx={{ margin: "0 auto", maxWidth: "350px" }}>
|
||||
{questions.filter((q:AnyQuestion) => (q.type && !q.content.rule.parentId)).map((question: AnyTypedQuizQuestion, index:number) => (
|
||||
{questions.filter((q:AnyQuestion) => {
|
||||
console.log(q.content)
|
||||
if (q.content === null) return true
|
||||
return (q.type && !q.content.rule.parentId)}).map((question: AnyTypedQuizQuestion, index:number) => (
|
||||
<Button
|
||||
key={question.content.id}
|
||||
onClick={() => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user