неактивные результы не выводятся к редактированию
This commit is contained in:
parent
5a67f584f6
commit
c043c7d1ae
@ -46,6 +46,9 @@ export const ResultSettings = () => {
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const cnsl = results.filter(q=> q.content.usage)
|
||||||
|
console.log(cnsl)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box sx={{ maxWidth: "796px" }}>
|
<Box sx={{ maxWidth: "796px" }}>
|
||||||
<Box
|
<Box
|
||||||
@ -106,7 +109,7 @@ export const ResultSettings = () => {
|
|||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
{results.map((resultQuestion) => (
|
{cnsl.map((resultQuestion) => (
|
||||||
<ResultCard resultContract={resultContract} resultData={resultQuestion} key={resultQuestion.id} />
|
<ResultCard resultContract={resultContract} resultData={resultQuestion} key={resultQuestion.id} />
|
||||||
))}
|
))}
|
||||||
<Modal
|
<Modal
|
||||||
|
@ -180,24 +180,29 @@ export const deleteQuiz = async (quizId: string) => requestQueue.enqueue(async (
|
|||||||
export const updateRootContentId = (quizId: string, id: string) => {
|
export const updateRootContentId = (quizId: string, id: string) => {
|
||||||
|
|
||||||
if (id.length === 0) {//дерева больше не существует, все результаты неактивны кроме результата линейности
|
if (id.length === 0) {//дерева больше не существует, все результаты неактивны кроме результата линейности
|
||||||
|
console.log("дерева больше не существует")
|
||||||
useQuestionsStore.getState().questions.forEach((q) => {
|
useQuestionsStore.getState().questions.forEach((q) => {
|
||||||
if (q.type !== null && q.type === "result") {
|
if (q.type !== null && q.type === "result") {
|
||||||
if (q.content.rule.parentId === "line" && q.content.usage === false) {
|
if (q.content.rule.parentId === "line") {
|
||||||
updateQuestion(q.id, (q) => {
|
console.log("Этому резулту линейности я буду ставить true", q)
|
||||||
q.content.usage === true
|
if (q.content.usage === false) updateQuestion(q.id, (q) => {
|
||||||
|
q.content.usage = true
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
console.log("Этому резулту я буду ставить false", q)
|
||||||
updateQuestion(q.id, (q) => {
|
updateQuestion(q.id, (q) => {
|
||||||
q.content.usage === false
|
q.content.usage = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else { //было создано дерево, результат линейности неактивен
|
} else { //было создано дерево, результат линейности неактивен
|
||||||
|
console.log("дерев создаёттса")
|
||||||
useQuestionsStore.getState().questions.forEach((q) => {
|
useQuestionsStore.getState().questions.forEach((q) => {
|
||||||
if (q.type !== null && q.content.rule.parentId === "line") {
|
if (q.type !== null && q.content.rule.parentId === "line") {
|
||||||
|
console.log("Этому резулту линейности я буду ставить false", q)
|
||||||
updateQuestion(q.id, (q) => {
|
updateQuestion(q.id, (q) => {
|
||||||
q.content.usage === false
|
q.content.usage = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user