diff --git a/frontend/src/components/QuestionNotification.vue b/frontend/src/components/QuestionNotification.vue new file mode 100644 index 00000000..75540754 --- /dev/null +++ b/frontend/src/components/QuestionNotification.vue @@ -0,0 +1,24 @@ + + + diff --git a/frontend/src/views/learning-paths/LearningPathPage.vue b/frontend/src/views/learning-paths/LearningPathPage.vue index d5308b12..94d8e8a7 100644 --- a/frontend/src/views/learning-paths/LearningPathPage.vue +++ b/frontend/src/views/learning-paths/LearningPathPage.vue @@ -21,6 +21,7 @@ import {useStudentAssignmentsQuery, useStudentGroupsQuery} from "@/queries/students" import type { AssignmentDTO } from "@dwengo-1/common/interfaces/assignment"; import type { GroupDTO } from "@dwengo-1/common/interfaces/group"; +import QuestionNotification from "@/components/QuestionNotification.vue"; const router = useRouter(); const route = useRoute(); @@ -193,30 +194,6 @@ import type { GroupDTO } from "@dwengo-1/common/interfaces/group"; alert("Please type a question before submitting.") // TODO: i18n } } - - const learningObjectHasQuestions = computed(() => { - const result = new Map(); - const learningObjects = learningObjectListQueryResult.data?.value ?? []; - - learningObjects.forEach((learningObject) => { - const nodeLoId: LearningObjectIdentifierDTO = { - hruid: learningObject.key, - language: learningObject.language, - version: learningObject.version - }; - - // Check if the learning object has questions - const questions = useQuestionsQuery(nodeLoId).data.value?.questions as QuestionDTO[] || []; - result.set(learningObject.key, questions.length > 0); - }); - - return result; - }); - -// Helper function to check if a learning object has questions -function hasQuestions(learningObjectKey: string): boolean { - return learningObjectHasQuestions.value.get(learningObjectKey) ?? false; -} @@ -295,10 +272,7 @@ function hasQuestions(learningObjectKey: string): boolean { :icon="ICONS[getNavItemState(node)]" > - +