feat: leerkracht kan progress van groepen zien
This commit is contained in:
parent
509dd6bfab
commit
195e192598
4 changed files with 96 additions and 62 deletions
45
frontend/src/components/GroupProgressRow.vue
Normal file
45
frontend/src/components/GroupProgressRow.vue
Normal file
|
@ -0,0 +1,45 @@
|
|||
<script setup lang="ts">
|
||||
import { useGetLearningPathQuery } from "@/queries/learning-paths.ts";
|
||||
import { computed } from "vue";
|
||||
import type { Language } from "@/data-objects/language.ts";
|
||||
import type { LearningPath } from "@/data-objects/learning-paths/learning-path.ts";
|
||||
|
||||
const props = defineProps<{
|
||||
groupNumber: number;
|
||||
learningPath: string;
|
||||
language: Language;
|
||||
assignmentId: number;
|
||||
classId: string;
|
||||
}>();
|
||||
|
||||
function calculateProgress(lp: LearningPath): number {
|
||||
return ((lp.amountOfNodes - lp.amountOfNodesLeft) / lp.amountOfNodes) * 100;
|
||||
}
|
||||
|
||||
const query = useGetLearningPathQuery(
|
||||
() => props.learningPath,
|
||||
() => props.language,
|
||||
() => ({
|
||||
forGroup: props.groupNumber,
|
||||
assignmentNo: props.assignmentId,
|
||||
classId: props.classId,
|
||||
}),
|
||||
);
|
||||
|
||||
const progress = computed(() => {
|
||||
if (!query.data.value) return 0;
|
||||
return calculateProgress(query.data.value);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-progress-linear
|
||||
:model-value="progress"
|
||||
color="blue-grey"
|
||||
height="25"
|
||||
>
|
||||
<template v-slot:default="{ value }">
|
||||
<strong>{{ Math.ceil(value) }}%</strong>
|
||||
</template>
|
||||
</v-progress-linear>
|
||||
</template>
|
Loading…
Add table
Add a link
Reference in a new issue