Pull Request branch dev-clone to main #1

Merged
gitea merged 429 commits from dev-clone into main 2024-12-23 09:31:34 +00:00
Showing only changes of commit d4c8e90670 - Show all commits

View File

@ -82,10 +82,6 @@ export default function AssessmentPage() {
getQuestionsAllQueryOptions(page, limit)
);
// const handleFinishClick = () => {
// setModalOpen(true);
// };
// Fungsi untuk memeriksa pertanyaan yang belum dijawab
const checkUnansweredQuestions = () => {
// Misalkan data berisi pertanyaan dan jawaban
@ -108,8 +104,6 @@ export default function AssessmentPage() {
checkUnansweredQuestions();
};
useEffect(() => {
const id = getQueryParam("id");
@ -133,12 +127,13 @@ export default function AssessmentPage() {
setSelectedSubAspectId(firstMatchingSubAspect.id);
// Find the parent aspect and set its id as the selectedAspectId
const parentAspect = aspectsQuery.data.data.find(aspect =>
aspect.subAspects.some(sub => sub.id === firstMatchingSubAspect.id)
const parentAspect = aspectsQuery.data.data.find((aspect) =>
aspect.subAspects.some((sub) => sub.id === firstMatchingSubAspect.id)
);
if (parentAspect) {
setSelectedAspectId(parentAspect.id); // Use `id` from the parent aspect
setOpenAspects({ [parentAspect.id]: true }); // Open only relevant aspects
}
}
} else {
@ -149,9 +144,11 @@ export default function AssessmentPage() {
if (matchingAspect) {
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 {
console.warn("No matching aspect found for selected sub-aspect.");
setSelectedAspectId(null);
setOpenAspects({}); // Close all dropdowns if none of them match
}
}
}