Pull Request branch dev-clone to main #1
|
|
@ -82,10 +82,6 @@ export default function AssessmentPage() {
|
||||||
getQuestionsAllQueryOptions(page, limit)
|
getQuestionsAllQueryOptions(page, limit)
|
||||||
);
|
);
|
||||||
|
|
||||||
// const handleFinishClick = () => {
|
|
||||||
// setModalOpen(true);
|
|
||||||
// };
|
|
||||||
|
|
||||||
// Fungsi untuk memeriksa pertanyaan yang belum dijawab
|
// Fungsi untuk memeriksa pertanyaan yang belum dijawab
|
||||||
const checkUnansweredQuestions = () => {
|
const checkUnansweredQuestions = () => {
|
||||||
// Misalkan data berisi pertanyaan dan jawaban
|
// Misalkan data berisi pertanyaan dan jawaban
|
||||||
|
|
@ -108,8 +104,6 @@ export default function AssessmentPage() {
|
||||||
checkUnansweredQuestions();
|
checkUnansweredQuestions();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const id = getQueryParam("id");
|
const id = getQueryParam("id");
|
||||||
|
|
||||||
|
|
@ -133,12 +127,13 @@ export default function AssessmentPage() {
|
||||||
setSelectedSubAspectId(firstMatchingSubAspect.id);
|
setSelectedSubAspectId(firstMatchingSubAspect.id);
|
||||||
|
|
||||||
// Find the parent aspect and set its id as the selectedAspectId
|
// Find the parent aspect and set its id as the selectedAspectId
|
||||||
const parentAspect = aspectsQuery.data.data.find(aspect =>
|
const parentAspect = aspectsQuery.data.data.find((aspect) =>
|
||||||
aspect.subAspects.some(sub => sub.id === firstMatchingSubAspect.id)
|
aspect.subAspects.some((sub) => sub.id === firstMatchingSubAspect.id)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (parentAspect) {
|
if (parentAspect) {
|
||||||
setSelectedAspectId(parentAspect.id); // Use `id` from the parent aspect
|
setSelectedAspectId(parentAspect.id); // Use `id` from the parent aspect
|
||||||
|
setOpenAspects({ [parentAspect.id]: true }); // Open only relevant aspects
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -149,9 +144,11 @@ export default function AssessmentPage() {
|
||||||
|
|
||||||
if (matchingAspect) {
|
if (matchingAspect) {
|
||||||
setSelectedAspectId(matchingAspect.id); // Use `id` from the matching aspect
|
setSelectedAspectId(matchingAspect.id); // Use `id` from the matching aspect
|
||||||
|
setOpenAspects({ [matchingAspect.id]: true }); // Close all other dropdowns and open only the newly selected aspect
|
||||||
} else {
|
} else {
|
||||||
console.warn("No matching aspect found for selected sub-aspect.");
|
console.warn("No matching aspect found for selected sub-aspect.");
|
||||||
setSelectedAspectId(null);
|
setSelectedAspectId(null);
|
||||||
|
setOpenAspects({}); // Close all dropdowns if none of them match
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user