удаление нод нормально регулирует резулты
This commit is contained in:
parent
6d2fd7da4f
commit
2deae1bab2
@ -72,8 +72,8 @@ export const useRemoveNode = ({
|
|||||||
|
|
||||||
//Ищём родителя
|
//Ищём родителя
|
||||||
const parentQuestion = getQuestionByContentId(parentQuestionContentId);
|
const parentQuestion = getQuestionByContentId(parentQuestionContentId);
|
||||||
|
if (parentQuestion.content.rule.children.length === 1) { //если у родителя больше нет потомков
|
||||||
//Делаем результат родителя активным
|
//Делаем результат родителя активным
|
||||||
const parentResult = trashQuestions.find(q => q.type === "result" && q.content.rule.parentId === parentQuestionContentId)
|
const parentResult = trashQuestions.find(q => q.type === "result" && q.content.rule.parentId === parentQuestionContentId)
|
||||||
if (parentResult) {
|
if (parentResult) {
|
||||||
updateQuestion(parentResult.content.id, q => {
|
updateQuestion(parentResult.content.id, q => {
|
||||||
@ -83,6 +83,9 @@ export const useRemoveNode = ({
|
|||||||
createResult(quiz?.backendId, parentQuestionContentId)
|
createResult(quiz?.backendId, parentQuestionContentId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//чистим rule родителя
|
//чистим rule родителя
|
||||||
if (!parentQuestion?.type) {
|
if (!parentQuestion?.type) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user