From f85abea6f36a487a039a3ac5798a6a006cbd797c Mon Sep 17 00:00:00 2001 From: Gabriellvl Date: Mon, 19 May 2025 23:43:01 +0200 Subject: [PATCH 01/31] fix: maak questions zichtbaar enkel voor groep --- frontend/src/controllers/questions.ts | 4 ++ frontend/src/queries/questions.ts | 24 ++++++++++ .../views/learning-paths/LearningPathPage.vue | 48 +++++++++++-------- 3 files changed, 55 insertions(+), 21 deletions(-) diff --git a/frontend/src/controllers/questions.ts b/frontend/src/controllers/questions.ts index 86f4a56d..bca464ae 100644 --- a/frontend/src/controllers/questions.ts +++ b/frontend/src/controllers/questions.ts @@ -18,6 +18,10 @@ export class QuestionController extends BaseController { this.loId = loId; } + async getAllGroup(classId: string, assignmentId: string, forStudent: string, full = true): Promise { + return this.get("/", { lang: this.loId.language, full, classId, assignmentId, forStudent }); + } + async getAll(full = true): Promise { return this.get("/", { lang: this.loId.language, full }); } diff --git a/frontend/src/queries/questions.ts b/frontend/src/queries/questions.ts index 66f1492f..a8fc485e 100644 --- a/frontend/src/queries/questions.ts +++ b/frontend/src/queries/questions.ts @@ -17,6 +17,16 @@ export function questionsQueryKey( return ["questions", loId.hruid, loId.version!, loId.language, full]; } +export function questionsGroupQueryKey( + loId: LearningObjectIdentifierDTO, + classId: string, + assignmentId: string, + student: string, + full: boolean, +): [string, string, number, string, boolean] { + return ["questions", loId.hruid, loId.version!, loId.language, full, classId, assignmentId, student]; +} + export function questionQueryKey(questionId: QuestionId): [string, string, number, string, number] { const loId = questionId.learningObjectIdentifier; return ["question", loId.hruid, loId.version!, loId.language, questionId.sequenceNumber]; @@ -33,6 +43,20 @@ export function useQuestionsQuery( }); } +export function useQuestionsGroupQuery( + loId: MaybeRefOrGetter, + classId: MaybeRefOrGetter, + assignmentId: MaybeRefOrGetter, + student: MaybeRefOrGetter, + full: MaybeRefOrGetter = true, +): UseQueryReturnType { + return useQuery({ + queryKey: computed(() => questionsGroupQueryKey(toValue(loId), toValue(full), toValue(classId), toValue(assignmentId), toValue(student))), + queryFn: async () => new QuestionController(toValue(loId)).getAllGroup( toValue(classId), toValue(assignmentId), toValue(student),toValue(full)), + enabled: () => Boolean(toValue(loId)), + }); +} + export function useQuestionQuery( questionId: MaybeRefOrGetter, ): UseQueryReturnType { diff --git a/frontend/src/views/learning-paths/LearningPathPage.vue b/frontend/src/views/learning-paths/LearningPathPage.vue index c41f6063..1618e6ac 100644 --- a/frontend/src/views/learning-paths/LearningPathPage.vue +++ b/frontend/src/views/learning-paths/LearningPathPage.vue @@ -13,13 +13,11 @@ import authService from "@/services/auth/auth-service.ts"; import { LearningPathNode } from "@/data-objects/learning-paths/learning-path-node.ts"; import LearningPathGroupSelector from "@/views/learning-paths/LearningPathGroupSelector.vue"; - import { useCreateQuestionMutation, useQuestionsQuery } from "@/queries/questions"; + import {useQuestionsGroupQuery, useQuestionsQuery} from "@/queries/questions"; import type { QuestionsResponse } from "@/controllers/questions"; import type { LearningObjectIdentifierDTO } from "@dwengo-1/common/interfaces/learning-content"; import QandA from "@/components/QandA.vue"; import type { QuestionDTO } from "@dwengo-1/common/interfaces/question"; - import { useStudentAssignmentsQuery, useStudentGroupsQuery } from "@/queries/students"; - import type { AssignmentDTO } from "@dwengo-1/common/interfaces/assignment"; import QuestionNotification from "@/components/QuestionNotification.vue"; import QuestionBox from "@/components/QuestionBox.vue"; import { AccountType } from "@dwengo-1/common/util/account-types"; @@ -78,16 +76,32 @@ return currentIndex < nodesList.value?.length ? nodesList.value?.[currentIndex - 1] : undefined; }); - const getQuestionsQuery = useQuestionsQuery( - computed( - () => - ({ - language: currentNode.value?.language, - hruid: currentNode.value?.learningobjectHruid, - version: currentNode.value?.version, - }) as LearningObjectIdentifierDTO, - ), - ); + + + let getQuestionsQuery; + + + + if (authService.authState.activeRole === AccountType.Student) { + getQuestionsQuery = useQuestionsGroupQuery( + computed(() => ({ + language: currentNode.value?.language, + hruid: currentNode.value?.learningobjectHruid, + version: currentNode.value?.version, + }) as LearningObjectIdentifierDTO), + computed(() => query.value.classId ?? ""), + computed(() => query.value.assignmentNo ?? ""), + computed(() => authService.authState.user?.profile.preferred_username ?? "") + ); + } else { + getQuestionsQuery = useQuestionsQuery( + computed(() => ({ + language: currentNode.value?.language, + hruid: currentNode.value?.learningobjectHruid, + version: currentNode.value?.version, + }) as LearningObjectIdentifierDTO) + ); + } const navigationDrawerShown = ref(true); @@ -147,18 +161,10 @@ }); } - const studentAssignmentsQueryResult = useStudentAssignmentsQuery( - authService.authState.user?.profile.preferred_username, - ); - const loID: LearningObjectIdentifierDTO = { hruid: props.learningObjectHruid as string, language: props.language, }; - const createQuestionMutation = useCreateQuestionMutation(loID); - const groupsQueryResult = useStudentGroupsQuery(authService.authState.user?.profile.preferred_username); - - const questionInput = ref(""); const discussionLink = computed( () => From 84b2cb17497e3fa7600d36e97cc27da2768c3e99 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Mon, 19 May 2025 21:44:54 +0000 Subject: [PATCH 02/31] style: fix linting issues met Prettier --- frontend/src/controllers/questions.ts | 7 +++- frontend/src/queries/questions.ts | 18 ++++++++-- .../views/learning-paths/LearningPathPage.vue | 34 ++++++++++--------- 3 files changed, 40 insertions(+), 19 deletions(-) diff --git a/frontend/src/controllers/questions.ts b/frontend/src/controllers/questions.ts index bca464ae..fb4149f4 100644 --- a/frontend/src/controllers/questions.ts +++ b/frontend/src/controllers/questions.ts @@ -18,7 +18,12 @@ export class QuestionController extends BaseController { this.loId = loId; } - async getAllGroup(classId: string, assignmentId: string, forStudent: string, full = true): Promise { + async getAllGroup( + classId: string, + assignmentId: string, + forStudent: string, + full = true, + ): Promise { return this.get("/", { lang: this.loId.language, full, classId, assignmentId, forStudent }); } diff --git a/frontend/src/queries/questions.ts b/frontend/src/queries/questions.ts index a8fc485e..920f41da 100644 --- a/frontend/src/queries/questions.ts +++ b/frontend/src/queries/questions.ts @@ -51,8 +51,22 @@ export function useQuestionsGroupQuery( full: MaybeRefOrGetter = true, ): UseQueryReturnType { return useQuery({ - queryKey: computed(() => questionsGroupQueryKey(toValue(loId), toValue(full), toValue(classId), toValue(assignmentId), toValue(student))), - queryFn: async () => new QuestionController(toValue(loId)).getAllGroup( toValue(classId), toValue(assignmentId), toValue(student),toValue(full)), + queryKey: computed(() => + questionsGroupQueryKey( + toValue(loId), + toValue(full), + toValue(classId), + toValue(assignmentId), + toValue(student), + ), + ), + queryFn: async () => + new QuestionController(toValue(loId)).getAllGroup( + toValue(classId), + toValue(assignmentId), + toValue(student), + toValue(full), + ), enabled: () => Boolean(toValue(loId)), }); } diff --git a/frontend/src/views/learning-paths/LearningPathPage.vue b/frontend/src/views/learning-paths/LearningPathPage.vue index 1618e6ac..cdf51703 100644 --- a/frontend/src/views/learning-paths/LearningPathPage.vue +++ b/frontend/src/views/learning-paths/LearningPathPage.vue @@ -13,7 +13,7 @@ import authService from "@/services/auth/auth-service.ts"; import { LearningPathNode } from "@/data-objects/learning-paths/learning-path-node.ts"; import LearningPathGroupSelector from "@/views/learning-paths/LearningPathGroupSelector.vue"; - import {useQuestionsGroupQuery, useQuestionsQuery} from "@/queries/questions"; + import { useQuestionsGroupQuery, useQuestionsQuery } from "@/queries/questions"; import type { QuestionsResponse } from "@/controllers/questions"; import type { LearningObjectIdentifierDTO } from "@dwengo-1/common/interfaces/learning-content"; import QandA from "@/components/QandA.vue"; @@ -76,30 +76,32 @@ return currentIndex < nodesList.value?.length ? nodesList.value?.[currentIndex - 1] : undefined; }); - - let getQuestionsQuery; - - if (authService.authState.activeRole === AccountType.Student) { getQuestionsQuery = useQuestionsGroupQuery( - computed(() => ({ - language: currentNode.value?.language, - hruid: currentNode.value?.learningobjectHruid, - version: currentNode.value?.version, - }) as LearningObjectIdentifierDTO), + computed( + () => + ({ + language: currentNode.value?.language, + hruid: currentNode.value?.learningobjectHruid, + version: currentNode.value?.version, + }) as LearningObjectIdentifierDTO, + ), computed(() => query.value.classId ?? ""), computed(() => query.value.assignmentNo ?? ""), - computed(() => authService.authState.user?.profile.preferred_username ?? "") + computed(() => authService.authState.user?.profile.preferred_username ?? ""), ); } else { getQuestionsQuery = useQuestionsQuery( - computed(() => ({ - language: currentNode.value?.language, - hruid: currentNode.value?.learningobjectHruid, - version: currentNode.value?.version, - }) as LearningObjectIdentifierDTO) + computed( + () => + ({ + language: currentNode.value?.language, + hruid: currentNode.value?.learningobjectHruid, + version: currentNode.value?.version, + }) as LearningObjectIdentifierDTO, + ), ); } From 8e50bdef2104047e2706d5c3987b2889b5c34705 Mon Sep 17 00:00:00 2001 From: laurejablonski Date: Tue, 20 May 2025 00:13:24 +0200 Subject: [PATCH 03/31] fix: questions worden meteen herladen bij aanmaken nieuwe question zodat deze meteen getoond wordt --- frontend/src/components/QuestionBox.vue | 5 ++++- frontend/src/controllers/questions.ts | 1 + frontend/src/views/learning-paths/LearningPathPage.vue | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/QuestionBox.vue b/frontend/src/components/QuestionBox.vue index aac5955f..13bb1536 100644 --- a/frontend/src/components/QuestionBox.vue +++ b/frontend/src/components/QuestionBox.vue @@ -1,7 +1,7 @@ From 74099fedc7a48ce48a9362465b8127d1762d59bf Mon Sep 17 00:00:00 2001 From: Lint Action Date: Tue, 20 May 2025 11:52:23 +0000 Subject: [PATCH 15/31] style: fix linting issues met Prettier --- backend/src/services/assignments.ts | 3 +-- frontend/src/views/assignments/TeacherAssignment.vue | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/backend/src/services/assignments.ts b/backend/src/services/assignments.ts index e96b8dd8..afa4c759 100644 --- a/backend/src/services/assignments.ts +++ b/backend/src/services/assignments.ts @@ -103,7 +103,6 @@ function hasDuplicates(arr: string[]): boolean { export async function putAssignment(classid: string, id: number, assignmentData: Partial): Promise { const assignment = await fetchAssignment(classid, id); - if (assignmentData.groups) { if (hasDuplicates(assignmentData.groups.flat() as string[])) { throw new BadRequestException('Student can only be in one group'); @@ -124,7 +123,7 @@ export async function putAssignment(classid: string, id: number, assignmentData: await groupRepository.save(newGroup); }) ); - } catch(e: unknown) { + } catch (e: unknown) { if (e instanceof ForeignKeyConstraintViolationException || e instanceof PostgreSqlExceptionConverter) { throw new ConflictException('Cannot update assigment with questions or submissions'); } else { diff --git a/frontend/src/views/assignments/TeacherAssignment.vue b/frontend/src/views/assignments/TeacherAssignment.vue index c860fc04..653ed1ca 100644 --- a/frontend/src/views/assignments/TeacherAssignment.vue +++ b/frontend/src/views/assignments/TeacherAssignment.vue @@ -149,7 +149,7 @@ const message = err.response?.data?.error || err.message || t("unknownError"); showSnackbar(t("failed") + ": " + message, "error"); }, - } + }, ); } From cac944e9c36da1260c08c4396588777b401846ec Mon Sep 17 00:00:00 2001 From: Gerald Schmittinger Date: Tue, 20 May 2025 14:44:26 +0200 Subject: [PATCH 16/31] fix(frontend): Juiste groep ID gebruiken op leerpadpagina. Vroeger werd zowel bij de redirect vanuit assignments als bij het kiezen van een groep in de ComboBox de "mooie" groeps-ID i.p.v. de echte gebruikt. --- .../src/components/GroupSubmissionStatus.vue | 2 +- .../LearningPathGroupSelector.vue | 21 ++++++++----------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/frontend/src/components/GroupSubmissionStatus.vue b/frontend/src/components/GroupSubmissionStatus.vue index d8559cab..023a5050 100644 --- a/frontend/src/components/GroupSubmissionStatus.vue +++ b/frontend/src/components/GroupSubmissionStatus.vue @@ -41,7 +41,7 @@ {{ data.submissions.length > 0 ? t("submission") : t("noSubmissionsYet") }} diff --git a/frontend/src/views/learning-paths/LearningPathGroupSelector.vue b/frontend/src/views/learning-paths/LearningPathGroupSelector.vue index f6ae4027..89b42eeb 100644 --- a/frontend/src/views/learning-paths/LearningPathGroupSelector.vue +++ b/frontend/src/views/learning-paths/LearningPathGroupSelector.vue @@ -16,18 +16,14 @@ const groupsQuery = useGroupsQuery(props.classId, props.assignmentNumber, true); - interface GroupSelectorOption { - groupNumber: number | undefined; - label: string; + function sortedGroups(groups: GroupDTO[]): GroupDTO[] { + return [...groups].sort((a, b) => a.groupNumber - b.groupNumber) } - - function groupOptions(groups: GroupDTO[]): GroupSelectorOption[] { - return [...groups] - .sort((a, b) => a.groupNumber - b.groupNumber) - .map((group, index) => ({ - groupNumber: group.groupNumber, - label: `${index + 1}`, - })); + function groupOptions(groups: GroupDTO[]): number[] { + return sortedGroups(groups).map((group) => group.groupNumber); + } + function labelForGroup(groups: GroupDTO[], groupId: number): string { + return `${sortedGroups(groups).findIndex(group => group.groupNumber === groupId) + 1}`; } @@ -40,7 +36,8 @@ :label="t('viewAsGroup')" :items="groupOptions(data.groups)" v-model="model" - item-title="label" + :item-title="item => labelForGroup(data.groups, parseInt(`${item}`))" + :item-value="item => item" class="group-selector-cb" variant="outlined" clearable From 5afa4c231222713627f9cca381aa6395478062fd Mon Sep 17 00:00:00 2001 From: Lint Action Date: Tue, 20 May 2025 12:45:24 +0000 Subject: [PATCH 17/31] style: fix linting issues met Prettier --- .../views/learning-paths/LearningPathGroupSelector.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/views/learning-paths/LearningPathGroupSelector.vue b/frontend/src/views/learning-paths/LearningPathGroupSelector.vue index 89b42eeb..e999fbd6 100644 --- a/frontend/src/views/learning-paths/LearningPathGroupSelector.vue +++ b/frontend/src/views/learning-paths/LearningPathGroupSelector.vue @@ -17,13 +17,13 @@ const groupsQuery = useGroupsQuery(props.classId, props.assignmentNumber, true); function sortedGroups(groups: GroupDTO[]): GroupDTO[] { - return [...groups].sort((a, b) => a.groupNumber - b.groupNumber) + return [...groups].sort((a, b) => a.groupNumber - b.groupNumber); } function groupOptions(groups: GroupDTO[]): number[] { return sortedGroups(groups).map((group) => group.groupNumber); } function labelForGroup(groups: GroupDTO[], groupId: number): string { - return `${sortedGroups(groups).findIndex(group => group.groupNumber === groupId) + 1}`; + return `${sortedGroups(groups).findIndex((group) => group.groupNumber === groupId) + 1}`; } @@ -36,8 +36,8 @@ :label="t('viewAsGroup')" :items="groupOptions(data.groups)" v-model="model" - :item-title="item => labelForGroup(data.groups, parseInt(`${item}`))" - :item-value="item => item" + :item-title="(item) => labelForGroup(data.groups, parseInt(`${item}`))" + :item-value="(item) => item" class="group-selector-cb" variant="outlined" clearable From 2b90f20d459236c312baa6889f9893f3a2def44c Mon Sep 17 00:00:00 2001 From: Gerald Schmittinger Date: Tue, 20 May 2025 15:57:01 +0200 Subject: [PATCH 18/31] fix(backend): Workaround MikroORM syntax error --- backend/src/data/dwengo-entity-repository.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/backend/src/data/dwengo-entity-repository.ts b/backend/src/data/dwengo-entity-repository.ts index f17b6976..3fe23711 100644 --- a/backend/src/data/dwengo-entity-repository.ts +++ b/backend/src/data/dwengo-entity-repository.ts @@ -1,12 +1,25 @@ -import { EntityRepository, FilterQuery } from '@mikro-orm/core'; +import { EntityRepository, FilterQuery, SyntaxErrorException } from '@mikro-orm/core'; import { EntityAlreadyExistsException } from '../exceptions/entity-already-exists-exception.js'; +import { getLogger } from '../logging/initalize.js'; export abstract class DwengoEntityRepository extends EntityRepository { public async save(entity: T, options?: { preventOverwrite?: boolean }): Promise { if (options?.preventOverwrite && (await this.findOne(entity))) { throw new EntityAlreadyExistsException(`A ${this.getEntityName()} with this identifier already exists.`); } - await this.getEntityManager().persistAndFlush(entity); + try { + await this.getEntityManager().persistAndFlush(entity); + } catch (e: unknown) { + // Workaround for MikroORM bug: Sometimes, queries are generated with random syntax errors. + // The faulty query is then retried everytime something is persisted. By clearing the entity + // Manager in that case, we make sure that future queries will work. + if (e instanceof SyntaxErrorException) { + getLogger().error("SyntaxErrorException caught => entity manager cleared."); + this.em.clear(); + } else { + throw e; + } + } } public async deleteWhere(query: FilterQuery): Promise { const toDelete = await this.findOne(query); From 65d79b010cbd944cf41143e1c2172bb362f10806 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Tue, 20 May 2025 13:57:58 +0000 Subject: [PATCH 19/31] style: fix linting issues met Prettier --- backend/src/data/dwengo-entity-repository.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/data/dwengo-entity-repository.ts b/backend/src/data/dwengo-entity-repository.ts index 3fe23711..64a129ce 100644 --- a/backend/src/data/dwengo-entity-repository.ts +++ b/backend/src/data/dwengo-entity-repository.ts @@ -14,7 +14,7 @@ export abstract class DwengoEntityRepository extends EntityRep // The faulty query is then retried everytime something is persisted. By clearing the entity // Manager in that case, we make sure that future queries will work. if (e instanceof SyntaxErrorException) { - getLogger().error("SyntaxErrorException caught => entity manager cleared."); + getLogger().error('SyntaxErrorException caught => entity manager cleared.'); this.em.clear(); } else { throw e; From 4e412f47f5201beba96e11232bb5512082130a3d Mon Sep 17 00:00:00 2001 From: Adriaan Jacquet Date: Tue, 20 May 2025 17:53:16 +0200 Subject: [PATCH 20/31] fix: missende import voor query in learningpathpage --- frontend/src/views/learning-paths/LearningPathPage.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/views/learning-paths/LearningPathPage.vue b/frontend/src/views/learning-paths/LearningPathPage.vue index 193855f3..160087e9 100644 --- a/frontend/src/views/learning-paths/LearningPathPage.vue +++ b/frontend/src/views/learning-paths/LearningPathPage.vue @@ -13,7 +13,7 @@ import authService from "@/services/auth/auth-service.ts"; import { LearningPathNode } from "@/data-objects/learning-paths/learning-path-node.ts"; import LearningPathGroupSelector from "@/views/learning-paths/LearningPathGroupSelector.vue"; - import { useQuestionsQuery } from "@/queries/questions"; + import { useQuestionsGroupQuery, useQuestionsQuery } from "@/queries/questions"; import type { QuestionsResponse } from "@/controllers/questions"; import type { LearningObjectIdentifierDTO } from "@dwengo-1/common/interfaces/learning-content"; import QandA from "@/components/QandA.vue"; From 8f1194a021e58c6839aeae6534a4a317be131918 Mon Sep 17 00:00:00 2001 From: Gerald Schmittinger Date: Tue, 20 May 2025 18:10:14 +0200 Subject: [PATCH 21/31] fix(frontend): Assignment wordt met taal uit locale i.p.v. juiste taal aangemaakt. --- frontend/src/views/assignments/CreateAssignment.vue | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/assignments/CreateAssignment.vue b/frontend/src/views/assignments/CreateAssignment.vue index 745fccc3..deb56879 100644 --- a/frontend/src/views/assignments/CreateAssignment.vue +++ b/frontend/src/views/assignments/CreateAssignment.vue @@ -62,7 +62,10 @@ const { valid } = await form.value.validate(); if (!valid) return; - const lp = lpIsSelected.value ? route.query.hruid?.toString() : selectedLearningPath.value?.hruid; + const lp = lpIsSelected.value + ? { hruid: route.query.hruid!.toString(), language: language.value } + : { hruid: selectedLearningPath.value!.hruid, language: selectedLearningPath.value!.language }; + if (!lp) { return; } @@ -72,8 +75,8 @@ within: selectedClass.value?.id || "", title: assignmentTitle.value, description: "", - learningPath: lp, - language: language.value, + learningPath: lp.hruid, + language: lp.language, deadline: null, groups: [], }; From da0137e0a7d21b0f21dc4732df413fb5bf6397c7 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Tue, 20 May 2025 16:14:17 +0000 Subject: [PATCH 22/31] style: fix linting issues met Prettier --- frontend/src/views/assignments/CreateAssignment.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/assignments/CreateAssignment.vue b/frontend/src/views/assignments/CreateAssignment.vue index deb56879..e5d696b4 100644 --- a/frontend/src/views/assignments/CreateAssignment.vue +++ b/frontend/src/views/assignments/CreateAssignment.vue @@ -63,8 +63,8 @@ if (!valid) return; const lp = lpIsSelected.value - ? { hruid: route.query.hruid!.toString(), language: language.value } - : { hruid: selectedLearningPath.value!.hruid, language: selectedLearningPath.value!.language }; + ? { hruid: route.query.hruid!.toString(), language: language.value } + : { hruid: selectedLearningPath.value!.hruid, language: selectedLearningPath.value!.language }; if (!lp) { return; From d1e9303d3a579d30cee0d457fe3f78e3838bb35f Mon Sep 17 00:00:00 2001 From: Gerald Schmittinger Date: Tue, 20 May 2025 18:30:01 +0200 Subject: [PATCH 23/31] fix(frontend): Teacher only leerobjecten niet meer getoond aan studenten --- .../src/views/learning-paths/LearningPathPage.vue | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/learning-paths/LearningPathPage.vue b/frontend/src/views/learning-paths/LearningPathPage.vue index 160087e9..cd81bb41 100644 --- a/frontend/src/views/learning-paths/LearningPathPage.vue +++ b/frontend/src/views/learning-paths/LearningPathPage.vue @@ -56,7 +56,9 @@ const learningObjectListQueryResult = useLearningObjectListForPathQuery(learningPathQueryResult.data); const nodesList: ComputedRef = computed( - () => learningPathQueryResult.data.value?.nodesAsList ?? null, + () => learningPathQueryResult.data.value?.nodesAsList.filter(node => + authService.authState.activeRole === AccountType.Teacher || !getLearningObjectForNode(node)?.teacherExclusive + ) ?? null, ); const currentNode = computed(() => { @@ -107,6 +109,12 @@ const navigationDrawerShown = ref(true); + function getLearningObjectForNode(node: LearningPathNode): LearningObject | undefined { + return learningObjectListQueryResult.data.value?.find(obj => + obj.key === node.learningobjectHruid && obj.language === node.language && obj.version === node.version + ); + } + function isLearningObjectCompleted(learningObject: LearningObject): boolean { if (learningObjectListQueryResult.isSuccess) { return ( @@ -353,7 +361,6 @@ class: forGroup.classId, groupNumber: forGroup.forGroup, }" - @updated="refetchQuestions" /> From fa0e45ea4890c0f4e7547bd52100aadc53a0c1cc Mon Sep 17 00:00:00 2001 From: Lint Action Date: Tue, 20 May 2025 16:34:19 +0000 Subject: [PATCH 24/31] style: fix linting issues met Prettier --- .../src/views/learning-paths/LearningPathPage.vue | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/frontend/src/views/learning-paths/LearningPathPage.vue b/frontend/src/views/learning-paths/LearningPathPage.vue index cd81bb41..d908cc2d 100644 --- a/frontend/src/views/learning-paths/LearningPathPage.vue +++ b/frontend/src/views/learning-paths/LearningPathPage.vue @@ -56,9 +56,12 @@ const learningObjectListQueryResult = useLearningObjectListForPathQuery(learningPathQueryResult.data); const nodesList: ComputedRef = computed( - () => learningPathQueryResult.data.value?.nodesAsList.filter(node => - authService.authState.activeRole === AccountType.Teacher || !getLearningObjectForNode(node)?.teacherExclusive - ) ?? null, + () => + learningPathQueryResult.data.value?.nodesAsList.filter( + (node) => + authService.authState.activeRole === AccountType.Teacher || + !getLearningObjectForNode(node)?.teacherExclusive, + ) ?? null, ); const currentNode = computed(() => { @@ -110,8 +113,9 @@ const navigationDrawerShown = ref(true); function getLearningObjectForNode(node: LearningPathNode): LearningObject | undefined { - return learningObjectListQueryResult.data.value?.find(obj => - obj.key === node.learningobjectHruid && obj.language === node.language && obj.version === node.version + return learningObjectListQueryResult.data.value?.find( + (obj) => + obj.key === node.learningobjectHruid && obj.language === node.language && obj.version === node.version, ); } From c9406f52aa9715b288364c4b121888cd82d7be1c Mon Sep 17 00:00:00 2001 From: Tibo De Peuter Date: Tue, 20 May 2025 18:42:54 +0200 Subject: [PATCH 25/31] fix(frontend): Submission status per groep --- .../src/components/GroupSubmissionStatus.vue | 40 +++++++++++-------- frontend/src/controllers/assignments.ts | 4 ++ frontend/src/queries/assignments.ts | 2 +- .../views/assignments/TeacherAssignment.vue | 9 +++-- 4 files changed, 34 insertions(+), 21 deletions(-) diff --git a/frontend/src/components/GroupSubmissionStatus.vue b/frontend/src/components/GroupSubmissionStatus.vue index 023a5050..0cab7efc 100644 --- a/frontend/src/components/GroupSubmissionStatus.vue +++ b/frontend/src/components/GroupSubmissionStatus.vue @@ -1,11 +1,13 @@ From a227694f7da111b13f013d5379b92a45a6f62b49 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Tue, 20 May 2025 17:03:41 +0000 Subject: [PATCH 30/31] style: fix linting issues met Prettier --- frontend/src/views/assignments/TeacherAssignment.vue | 3 ++- .../src/views/learning-paths/LearningPathPage.vue | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/frontend/src/views/assignments/TeacherAssignment.vue b/frontend/src/views/assignments/TeacherAssignment.vue index 15beea57..001a6f0d 100644 --- a/frontend/src/views/assignments/TeacherAssignment.vue +++ b/frontend/src/views/assignments/TeacherAssignment.vue @@ -415,7 +415,8 @@ :class-id="classId" :go-to-group-submission-link="goToGroupSubmissionLink" @update:hasSubmission=" - (hasSubmission) => (hasSubmissions = hasSubmissions || hasSubmission) + (hasSubmission) => + (hasSubmissions = hasSubmissions || hasSubmission) " /> diff --git a/frontend/src/views/learning-paths/LearningPathPage.vue b/frontend/src/views/learning-paths/LearningPathPage.vue index d5b8077a..90cfab7c 100644 --- a/frontend/src/views/learning-paths/LearningPathPage.vue +++ b/frontend/src/views/learning-paths/LearningPathPage.vue @@ -191,10 +191,13 @@ * in the query parameters are shown. This is relevant for teachers since they can view questions of all groups. */ function filterQuestions(questions?: QuestionDTO[]): QuestionDTO[] { - return questions?.filter(q => - q.inGroup.groupNumber === forGroup.value?.forGroup - && q.inGroup.assignment === forGroup.value?.assignmentNo - ) ?? [] + return ( + questions?.filter( + (q) => + q.inGroup.groupNumber === forGroup.value?.forGroup && + q.inGroup.assignment === forGroup.value?.assignmentNo, + ) ?? [] + ); } From 0abd91373d68fd20dfc522c67c93c62c6577bbf9 Mon Sep 17 00:00:00 2001 From: Joyelle Ndagijimana Date: Tue, 20 May 2025 20:31:54 +0200 Subject: [PATCH 31/31] fix: query refetchen ipv hele pagina reloaden --- frontend/src/views/assignments/UserAssignments.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/assignments/UserAssignments.vue b/frontend/src/views/assignments/UserAssignments.vue index 0fbdb6d2..09e84c15 100644 --- a/frontend/src/views/assignments/UserAssignments.vue +++ b/frontend/src/views/assignments/UserAssignments.vue @@ -1,5 +1,5 @@