From 90b5cd9d3a21b7707ba75a34668e13ab383cc8d8 Mon Sep 17 00:00:00 2001 From: Gerald Schmittinger Date: Fri, 18 Apr 2025 21:07:30 +0200 Subject: [PATCH] feat(frontend): Leerkrachten kunnen indieningen van verschillende groepen bekijken --- frontend/src/i18n/locale/en.json | 4 +- frontend/src/queries/groups.ts | 4 +- frontend/src/queries/learning-paths.ts | 2 +- .../LearningPathGroupSelector.vue | 55 +++++++++++++++++++ .../views/learning-paths/LearningPathPage.vue | 22 +++++++- 5 files changed, 81 insertions(+), 6 deletions(-) create mode 100644 frontend/src/views/learning-paths/LearningPathGroupSelector.vue diff --git a/frontend/src/i18n/locale/en.json b/frontend/src/i18n/locale/en.json index 6012787b..f7a6d9bc 100644 --- a/frontend/src/i18n/locale/en.json +++ b/frontend/src/i18n/locale/en.json @@ -84,5 +84,7 @@ "submittedBy": "Submitted by", "timestamp": "Timestamp", "loadSubmission": "Load", - "noSubmissionsYet": "No submissions yet." + "noSubmissionsYet": "No submissions yet.", + "viewAsGroup": "View progress of group...", + "group": "group" } diff --git a/frontend/src/queries/groups.ts b/frontend/src/queries/groups.ts index cdef2899..51c3c282 100644 --- a/frontend/src/queries/groups.ts +++ b/frontend/src/queries/groups.ts @@ -1,4 +1,3 @@ -import type { ClassesResponse } from "@/controllers/classes"; import { GroupController, type GroupResponse, type GroupsResponse } from "@/controllers/groups"; import type { QuestionsResponse } from "@/controllers/questions"; import type { SubmissionsResponse } from "@/controllers/submissions"; @@ -12,7 +11,6 @@ import { type UseQueryReturnType, } from "@tanstack/vue-query"; import { computed, toValue, type MaybeRefOrGetter } from "vue"; -import { invalidateAllAssignmentKeys } from "./assignments"; import { invalidateAllSubmissionKeys } from "./submissions"; export function groupsQueryKey(classid: string, assignmentNumber: number, full: boolean) { @@ -132,7 +130,7 @@ export function useDeleteGroupMutation(): UseMutationReturnType< const gn = response.group.groupNumber; await invalidateAllGroupKeys(queryClient, cid, an, gn); - await invalidateAllSubmissionKeys(queryClient, cid, an, gn); + await invalidateAllSubmissionKeys(queryClient, undefined, undefined, undefined, cid, an, gn); }, }); } diff --git a/frontend/src/queries/learning-paths.ts b/frontend/src/queries/learning-paths.ts index b9d3624a..69016a77 100644 --- a/frontend/src/queries/learning-paths.ts +++ b/frontend/src/queries/learning-paths.ts @@ -13,7 +13,7 @@ export function useGetLearningPathQuery( forGroup?: MaybeRefOrGetter<{forGroup: number, assignmentNo: number, classId: string} | undefined>, ): UseQueryReturnType { return useQuery({ - queryKey: [LEARNING_PATH_KEY, "get", toValue(hruid), toValue(language), toValue(forGroup)], + queryKey: [LEARNING_PATH_KEY, "get", hruid, language, forGroup], queryFn: async () => { const [hruidVal, languageVal, forGroupVal] = [toValue(hruid), toValue(language), toValue(forGroup)]; return learningPathController.getBy(hruidVal, languageVal, forGroupVal); diff --git a/frontend/src/views/learning-paths/LearningPathGroupSelector.vue b/frontend/src/views/learning-paths/LearningPathGroupSelector.vue new file mode 100644 index 00000000..dc3be31d --- /dev/null +++ b/frontend/src/views/learning-paths/LearningPathGroupSelector.vue @@ -0,0 +1,55 @@ + + + + + diff --git a/frontend/src/views/learning-paths/LearningPathPage.vue b/frontend/src/views/learning-paths/LearningPathPage.vue index 2412cee0..1630198b 100644 --- a/frontend/src/views/learning-paths/LearningPathPage.vue +++ b/frontend/src/views/learning-paths/LearningPathPage.vue @@ -3,7 +3,7 @@ import type { LearningPath } from "@/data-objects/learning-paths/learning-path.ts"; import { computed, type ComputedRef, ref } from "vue"; import type { LearningObject } from "@/data-objects/learning-objects/learning-object.ts"; - import { useRoute } from "vue-router"; + import {useRoute, useRouter} from "vue-router"; import LearningObjectView from "@/views/learning-paths/learning-object/LearningObjectView.vue"; import { useI18n } from "vue-i18n"; import LearningPathSearchField from "@/components/LearningPathSearchField.vue"; @@ -12,7 +12,9 @@ import UsingQueryResult from "@/components/UsingQueryResult.vue"; 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"; + const router = useRouter(); const route = useRoute(); const { t } = useI18n(); @@ -103,6 +105,15 @@ } return "notCompleted"; } + + const forGroupQueryParam = computed({ + get: () => route.query.forGroup, + set: (value: number | undefined) => { + let query = structuredClone(route.query); + query.forGroup = value; + router.push({ query }); + } + }); + + +