неактивные результы не выводятся к редактированию

This commit is contained in:
Nastya 2023-12-23 02:58:34 +03:00
parent 5a67f584f6
commit c043c7d1ae
2 changed files with 14 additions and 6 deletions

@ -46,6 +46,9 @@ export const ResultSettings = () => {
};
}, []);
const cnsl = results.filter(q=> q.content.usage)
console.log(cnsl)
return (
<Box sx={{ maxWidth: "796px" }}>
<Box
@ -106,7 +109,7 @@ export const ResultSettings = () => {
</Button>
</Box>
{results.map((resultQuestion) => (
{cnsl.map((resultQuestion) => (
<ResultCard resultContract={resultContract} resultData={resultQuestion} key={resultQuestion.id} />
))}
<Modal

@ -180,24 +180,29 @@ export const deleteQuiz = async (quizId: string) => requestQueue.enqueue(async (
export const updateRootContentId = (quizId: string, id: string) => {
if (id.length === 0) {//дерева больше не существует, все результаты неактивны кроме результата линейности
console.log("дерева больше не существует")
useQuestionsStore.getState().questions.forEach((q) => {
if (q.type !== null && q.type === "result") {
if (q.content.rule.parentId === "line" && q.content.usage === false) {
updateQuestion(q.id, (q) => {
q.content.usage === true
if (q.content.rule.parentId === "line") {
console.log("Этому резулту линейности я буду ставить true", q)
if (q.content.usage === false) updateQuestion(q.id, (q) => {
q.content.usage = true
})
} else {
console.log("Этому резулту я буду ставить false", q)
updateQuestion(q.id, (q) => {
q.content.usage === false
q.content.usage = false
})
}
}
})
} else { //было создано дерево, результат линейности неактивен
console.log("дерев создаёттса")
useQuestionsStore.getState().questions.forEach((q) => {
if (q.type !== null && q.content.rule.parentId === "line") {
console.log("Этому резулту линейности я буду ставить false", q)
updateQuestion(q.id, (q) => {
q.content.usage === false
q.content.usage = false
})
}