diff --git a/src/pages/Questions/BranchingMap/CsNodeButtons.tsx b/src/pages/Questions/BranchingMap/CsNodeButtons.tsx
index 46c071cb..6c6b7656 100644
--- a/src/pages/Questions/BranchingMap/CsNodeButtons.tsx
+++ b/src/pages/Questions/BranchingMap/CsNodeButtons.tsx
@@ -48,7 +48,6 @@ export default function CsNodeButtons({ csElements, cyRef }: Props) {
(acc, node) => ((acc[node.data.id] = {}), acc),
{},
);
-
return (
,
- !csElement.data.isRoot && (
+ (!csElement.data.isRoot && !isQuestionProhibited(csElement.data.qtype)) && (
{
const buttonData = buttonRefsById.current[csElement.data.id];
if (buttonData) buttonData.settings = r;
}}
- onClick={() => {
- updateOpenedModalSettingsId(csElement.data.id);
- }}
+ onClick={() => {
+ updateOpenedModalSettingsId(csElement.data.id,);
+ }}
/>
),
+ //оболочка узла
{
@@ -101,7 +101,8 @@ export default function CsNodeButtons({ csElements, cyRef }: Props) {
}}
onClick={() => {
setModalQuestionParentContentId(csElement.data.id);
- setOpenedModalQuestions(true);
+ console.log("csElement ", csElement)
+ setOpenedModalQuestions(!(isQuestionProhibited(csElement.data.type) && csElement.data.children > 0));
}}
/>,
])}
diff --git a/src/pages/Questions/BranchingMap/helper.ts b/src/pages/Questions/BranchingMap/helper.ts
index 911e7e80..94d59e60 100644
--- a/src/pages/Questions/BranchingMap/helper.ts
+++ b/src/pages/Questions/BranchingMap/helper.ts
@@ -23,8 +23,10 @@ export interface Node {
isRoot: boolean;
id: string;
label: string;
- qtype: QuestionType;
+ qtype: string;
+ type: string;
parent?: string;
+ children: number;
};
classes: string;
}
@@ -57,6 +59,9 @@ export const storeToNodes = (questions: AnyTypedQuizQuestion[]) => {
const edges: Edge[] = [];
questions.forEach((question) => {
if (question.content.rule.parentId) {
+ const parentQuestion = {
+ ...getQuestionByContentId(question.content.rule.parentId),
+ } as AnyTypedQuizQuestion;
let label =
question.title === "" || question.title === " "
? "noname"
@@ -68,7 +73,9 @@ export const storeToNodes = (questions: AnyTypedQuizQuestion[]) => {
isRoot: question.content.rule.parentId === "root",
id: question.content.id,
label,
- qtype: question.type
+ qtype: question.content.rule.parentId === "root" ? "root" : parentQuestion.type,
+ type: question.type,
+ children: question.content.rule.children.length
},
classes: "multiline-auto",
});
@@ -360,7 +367,7 @@ export const addNode = ({
}
};
-export const isQuestionProhibited = (parentQType: QuestionType) => (
+export const isQuestionProhibited = (parentQType: string) => (
parentQType === "text" ||
parentQType === "date" ||
parentQType === "number" ||