fix: students assignments pagina bug gefixd

This commit is contained in:
Joyelle Ndagijimana 2025-05-17 13:54:05 +02:00
parent 3d8c8302d6
commit 912111fce4
3 changed files with 7 additions and 13 deletions

View file

@ -1,7 +1,7 @@
<script setup lang="ts">
import { useI18n } from "vue-i18n";
import { computed, onMounted, ref, watch } from "vue";
import { assignmentTitleRules, classRules, learningPathRules } from "@/utils/assignment-rules.ts";
import { assignmentTitleRules, classRules } from "@/utils/assignment-rules.ts";
import auth from "@/services/auth/auth-service.ts";
import { useTeacherClassesQuery } from "@/queries/teachers.ts";
import { useRouter, useRoute } from "vue-router";
@ -34,8 +34,7 @@
const selectedClass = ref(undefined);
const assignmentTitle = ref("");
console.log(route.query);
const selectedLearningPath = ref(route.query.hruid || undefined);
const selectedLearningPath = ref(route.query.hruid?.toString() || undefined);
const lpIsSelected = route.query.hruid !== undefined;
@ -125,7 +124,7 @@
:rules="lpIsSelected ? [] : learningPathRules"
variant="solo-filled"
clearable
:model-value="lpIsSelected ? data.find(lp => lp.hruid === route.query.hruid) : selectedLearningPath"
:model-value="lpIsSelected ? data.find(lp => lp.hruid === route.query.hruid?.toString()) : selectedLearningPath"
item-title="title"
item-value="hruid"
:disabled="lpIsSelected"

View file

@ -6,11 +6,11 @@
import UsingQueryResult from "@/components/UsingQueryResult.vue";
import type { AssignmentResponse } from "@/controllers/assignments.ts";
import { asyncComputed } from "@vueuse/core";
import { useStudentsByUsernamesQuery } from "@/queries/students.ts";
import { useGroupsQuery } from "@/queries/groups.ts";
import {useStudentGroupsQuery, useStudentsByUsernamesQuery} from "@/queries/students.ts";
import { useGetLearningPathQuery } from "@/queries/learning-paths.ts";
import type { Language } from "@/data-objects/language.ts";
import { calculateProgress } from "@/utils/assignment-utils.ts";
import type {LearningPath} from "@/data-objects/learning-paths/learning-path.ts";
const props = defineProps<{
classId: string;
@ -29,7 +29,7 @@
const assignmentQueryResult = useAssignmentQuery(() => props.classId, props.assignmentId);
learningPath.value = assignmentQueryResult.data.value?.assignment?.learningPath;
const groupsQueryResult = useGroupsQuery(props.classId, props.assignmentId, true);
const groupsQueryResult = useStudentGroupsQuery(username, true);
const group = computed(() => {
const groups = groupsQueryResult.data.value?.groups;
@ -68,7 +68,7 @@
);
const progressColor = computed(() => {
const progress = calculateProgress(lpQueryResult.data.value);
const progress = calculateProgress(lpQueryResult.data.value as LearningPath);
if (progress >= 100) return "success";
if (progress >= 50) return "warning";
return "error";

View file

@ -21,11 +21,6 @@ import GroupSelector from "@/components/assignments/GroupSelector.vue";
const props = defineProps<{
classId: string;
assignmentId: number;
useGroupsWithProgress: (
groups: Ref<GroupDTO[]>,
hruid: Ref<string>,
language: Ref<Language>,
) => { groupProgressMap: Map<number, number> };
}>();
const isEditing = ref(false);