feat: mentor can remove mentee
This commit is contained in:
parent
5f9b7a86fd
commit
dd121fe1ac
|
|
@ -1,9 +1,17 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useLearningMentees } from "@/services/learningMentees";
|
import { useLearningMentees } from "@/services/learningMentees";
|
||||||
import { useCurrentCourseSession } from "@/composables";
|
import { useCurrentCourseSession } from "@/composables";
|
||||||
|
import { useCSRFFetch } from "@/fetchHelpers";
|
||||||
|
|
||||||
const courseSession = useCurrentCourseSession();
|
const courseSession = useCurrentCourseSession();
|
||||||
const { summary } = useLearningMentees(courseSession.value.id);
|
const { summary, fetchData } = useLearningMentees(courseSession.value.id);
|
||||||
|
|
||||||
|
const removeMyMentee = async (menteeId: string) => {
|
||||||
|
await useCSRFFetch(
|
||||||
|
`/api/mentor/${courseSession.value.id}/mentors/${summary.value?.mentor_id}/remove/${menteeId}`
|
||||||
|
).delete();
|
||||||
|
fetchData();
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -32,15 +40,23 @@ const { summary } = useLearningMentees(courseSession.value.id);
|
||||||
{{ participant.email }}
|
{{ participant.email }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<router-link
|
<div class="space-x-5">
|
||||||
:to="{
|
<router-link
|
||||||
name: 'profileLearningPath',
|
:to="{
|
||||||
params: { userId: participant.id, courseSlug: courseSession.course.slug },
|
name: 'profileLearningPath',
|
||||||
}"
|
params: {
|
||||||
class="underline"
|
userId: participant.id,
|
||||||
>
|
courseSlug: courseSession.course.slug,
|
||||||
{{ $t("cockpit.profileLink") }}
|
},
|
||||||
</router-link>
|
}"
|
||||||
|
class="underline"
|
||||||
|
>
|
||||||
|
{{ $t("cockpit.profileLink") }}
|
||||||
|
</router-link>
|
||||||
|
<button class="underline" @click="removeMyMentee(participant.id)">
|
||||||
|
{{ $t("a.Entfernen") }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ export interface Assignment {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Summary {
|
export interface Summary {
|
||||||
|
mentor_id: string;
|
||||||
participants: Participant[];
|
participants: Participant[];
|
||||||
circles: Circle[];
|
circles: Circle[];
|
||||||
assignments: Assignment[];
|
assignments: Assignment[];
|
||||||
|
|
|
||||||
|
|
@ -113,6 +113,11 @@ class LearningMentorAPITest(APITestCase):
|
||||||
self.assertEqual(participant_1["first_name"], "Test")
|
self.assertEqual(participant_1["first_name"], "Test")
|
||||||
self.assertEqual(participant_1["last_name"], "Participant_1")
|
self.assertEqual(participant_1["last_name"], "Participant_1")
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
response.data["mentor_id"],
|
||||||
|
mentor.id,
|
||||||
|
)
|
||||||
|
|
||||||
def test_api_self_evaluation_feedback(self) -> None:
|
def test_api_self_evaluation_feedback(self) -> None:
|
||||||
# GIVEN
|
# GIVEN
|
||||||
participants = [self.participant_1, self.participant_2, self.participant_3]
|
participants = [self.participant_1, self.participant_2, self.participant_3]
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ def mentor_summary(request, course_session_id: int):
|
||||||
)
|
)
|
||||||
return Response(
|
return Response(
|
||||||
{
|
{
|
||||||
|
"mentor_id": mentor.id,
|
||||||
"participants": [UserSerializer(user).data for user in users],
|
"participants": [UserSerializer(user).data for user in users],
|
||||||
"circles": list(
|
"circles": list(
|
||||||
Circle.objects.filter(id__in=circle_ids).values("id", "title")
|
Circle.objects.filter(id__in=circle_ids).values("id", "title")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue