fix: refresh mentor completions on submission
This commit is contained in:
parent
fa2e96d220
commit
a97ac4ec97
|
|
@ -1,8 +1,9 @@
|
|||
<script setup lang="ts">
|
||||
import type { Participant, PraxisAssignment } from "@/services/mentorCockpit";
|
||||
import { useMentorCockpit } from "@/services/mentorCockpit";
|
||||
import { computed, type Ref } from "vue";
|
||||
import { computed, onMounted, type Ref } from "vue";
|
||||
import { useCurrentCourseSession } from "@/composables";
|
||||
import log from "loglevel";
|
||||
|
||||
const props = defineProps<{
|
||||
praxisAssignmentId: string;
|
||||
|
|
@ -11,19 +12,19 @@ const props = defineProps<{
|
|||
const courseSession = useCurrentCourseSession();
|
||||
const mentorCockpitStore = useMentorCockpit(courseSession.value.id);
|
||||
|
||||
const participants = computed(() => mentorCockpitStore.summary.value?.participants);
|
||||
const praxisAssignment: Ref<PraxisAssignment | null> = computed(() =>
|
||||
mentorCockpitStore.getPraxisAssignmentById(props.praxisAssignmentId)
|
||||
);
|
||||
|
||||
const getParticipantById = (id: string): Participant | null => {
|
||||
if (mentorCockpitStore.summary.value?.participants) {
|
||||
const found = mentorCockpitStore.summary.value.participants.find(
|
||||
(item) => item.id === id
|
||||
);
|
||||
return found || null;
|
||||
}
|
||||
return null;
|
||||
return participants.value?.find((participant) => participant.id === id) || null;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
log.debug("MentorPraxisAssignment mounted");
|
||||
mentorCockpitStore.fetchData();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -109,7 +110,7 @@ const getParticipantById = (id: string): Participant | null => {
|
|||
class="underline"
|
||||
:to="item.url"
|
||||
>
|
||||
{{ $t("a.Bewertung anzeigen") }}
|
||||
{{ $t("a.Bewertung ansehen") }}
|
||||
</router-link>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { itGetCached } from "@/fetchHelpers";
|
||||
import { itGet } from "@/fetchHelpers";
|
||||
import type { Ref } from "vue";
|
||||
import { ref, watchEffect } from "vue";
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ export const useMentorCockpit = (
|
|||
summary.value = null;
|
||||
error.value = null;
|
||||
|
||||
itGetCached(`/api/mentor/${courseSessionId}/summary`)
|
||||
itGet(`/api/mentor/${courseSessionId}/summary`)
|
||||
.then((response) => {
|
||||
summary.value = response;
|
||||
})
|
||||
|
|
@ -94,5 +94,6 @@ export const useMentorCockpit = (
|
|||
error,
|
||||
getCircleTitleById,
|
||||
getPraxisAssignmentById,
|
||||
fetchData,
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue