From cac944e9c36da1260c08c4396588777b401846ec Mon Sep 17 00:00:00 2001 From: Gerald Schmittinger Date: Tue, 20 May 2025 14:44:26 +0200 Subject: [PATCH] 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