chore: remove getCircleTitleById

This commit is contained in:
Livio Bieri 2024-03-15 13:45:02 +01:00
parent 514649f358
commit f6d9cc9b63
9 changed files with 18 additions and 26 deletions

View File

@ -76,7 +76,7 @@ const filteredAssignments: Ref<Assignment[]> = computed(() => {
<template v-for="item in filteredAssignments" :key="item.id">
<PraxisAssignmentItem
v-if="item.type === 'praxis_assignment'"
:circle-title="learningMentees.getCircleTitleById(item.circle_id)"
:circle-title="item.circle_name"
:pending-tasks="item.pending_evaluations"
:task-link="{
name: 'learningMentorPraxisAssignments',
@ -86,7 +86,7 @@ const filteredAssignments: Ref<Assignment[]> = computed(() => {
/>
<SelfAssignmentFeedbackAssignmentItem
v-else-if="item.type === 'self_evaluation_feedback'"
:circle-title="learningMentees.getCircleTitleById(item.circle_id)"
:circle-title="item.circle_name"
:pending-tasks="item.pending_evaluations"
:task-link="{
name: 'learningMentorSelfEvaluationFeedbackAssignments',

View File

@ -30,9 +30,7 @@ onMounted(() => {
<div v-if="praxisAssignment">
<div class="p-6">
<h2 class="mb-2">{{ $t("a.Praxisauftrag") }}: {{ praxisAssignment.title }}</h2>
<span class="text-gray-800">
Circle «{{ learningMentees.getCircleTitleById(praxisAssignment.circle_id) }}»
</span>
<span class="text-gray-800">Circle «{{ praxisAssignment.circle_name }}»</span>
<template v-if="praxisAssignment.pending_evaluations > 0">
<div class="flex flex-row items-center space-x-2 pt-4">
<div

View File

@ -33,9 +33,7 @@ const getParticipantById = (id: string): Participant | null => {
{{ $t("a.Selbsteinschätzung") }}: {{ selfEvaluationFeedback.title }}
</h2>
<span class="text-gray-800">
Circle «{{
learningMentees.getCircleTitleById(selfEvaluationFeedback.circle_id)
}}»
Circle «{{ selfEvaluationFeedback.circle_name }}»
</span>
<template v-if="selfEvaluationFeedback.pending_evaluations > 0">
<div class="flex flex-row items-center space-x-2 pt-4">

View File

@ -34,12 +34,13 @@ export interface Assignment {
id: string;
title: string;
circle_id: string;
circle_name: string;
pending_evaluations: number;
completions: Completion[];
type: string;
}
interface Summary {
export interface Summary {
participants: Participant[];
circles: Circle[];
assignments: Assignment[];
@ -52,14 +53,6 @@ export const useLearningMentees = (
const summary: Ref<Summary | null> = ref(null);
const error = ref(null);
const getCircleTitleById = (id: string): string => {
if (summary.value?.circles) {
const circle = summary.value.circles.find((circle) => String(circle.id) === id);
return circle ? circle.title : "";
}
return "";
};
const getAssignmentById = (id: string): Assignment | null => {
if (summary.value?.assignments) {
const found = summary.value.assignments.find(
@ -92,7 +85,6 @@ export const useLearningMentees = (
isLoading,
summary,
error,
getCircleTitleById,
fetchData,
getAssignmentById,
};

View File

@ -110,19 +110,19 @@ def get_praxis_assignments(
]
)
circle_id = learning_content.get_circle().id
circle = learning_content.get_circle()
circle_ids.add(circle.id)
records.append(
MentorAssignmentStatus(
id=course_session_assignment.id,
title=learning_content.content_assignment.title,
circle_id=circle_id,
circle_id=circle.id,
circle_name=circle.title,
pending_evaluations=submitted_count,
completions=completions,
type=MentorAssignmentStatusType.PRAXIS_ASSIGNMENT,
)
)
circle_ids.add(circle_id)
return records, circle_ids

View File

@ -64,9 +64,6 @@ def get_self_feedback_evaluation(
feedback_provider_user=evaluation_user,
)
circle_id = learning_unit.get_circle().id
circle_ids.add(circle_id)
pending_evaluations = len([f for f in feedbacks if not f.feedback_submitted])
completions = [
@ -90,11 +87,15 @@ def get_self_feedback_evaluation(
participants=participants,
)
circle = learning_unit.get_circle()
circle_ids.add(circle.id)
records.append(
MentorAssignmentStatus(
id=learning_unit.id,
title=learning_unit.title,
circle_id=circle_id,
circle_id=circle.id,
circle_name=circle.title,
pending_evaluations=pending_evaluations,
completions=completions,
type=MentorAssignmentStatusType.SELF_EVALUATION_FEEDBACK,

View File

@ -27,6 +27,7 @@ class MentorAssignmentStatus:
id: str
title: str
circle_id: str
circle_name: str
pending_evaluations: int
completions: List[MentorAssignmentCompletion]
type: MentorAssignmentStatusType

View File

@ -19,6 +19,7 @@ class MentorAssignmentStatusSerializer(serializers.Serializer):
id = serializers.CharField()
title = serializers.CharField()
circle_id = serializers.CharField()
circle_name = serializers.CharField()
pending_evaluations = serializers.IntegerField()
completions = MentorAssignmentCompletionSerializer(many=True)
type = serializers.ReadOnlyField()

View File

@ -108,5 +108,6 @@ class AttendanceServicesTestCase(TestCase):
assignment = assignments[0]
self.assertEqual(assignment.pending_evaluations, 1)
self.assertEqual(assignment.title, "Dummy Assignment (PRAXIS_ASSIGNMENT)")
self.assertEqual(assignment.circle_name, "Circle")
self.assertEqual(assignment.circle_id, self.circle.id)
self.assertEqual(list(circle_ids)[0], self.circle.id)