From be835c27cfb1acb5e296c24d9260917e608da771 Mon Sep 17 00:00:00 2001 From: Arthur <110528300+c0rydoras@users.noreply.github.com> Date: Tue, 13 Aug 2024 15:18:01 +0200 Subject: [PATCH] fix(backend): only return employments and worktime-balances once (#406) before this employments and worktime-balances were returned an additional time for each supervisor. --- backend/timed/employment/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/timed/employment/views.py b/backend/timed/employment/views.py index da4adb577..ce287c989 100644 --- a/backend/timed/employment/views.py +++ b/backend/timed/employment/views.py @@ -219,7 +219,7 @@ def get_queryset(self): if not user.is_superuser: queryset = queryset.filter(Q(id=user.id) | Q(supervisors=user)) - return queryset + return queryset.distinct() class AbsenceBalanceViewSet(AggregateQuerysetMixin, ReadOnlyModelViewSet): @@ -346,7 +346,7 @@ def get_queryset(self) -> QuerySet[models.Employment]: if not user.is_superuser: queryset = queryset.filter(Q(user=user) | Q(user__supervisors=user)) - return queryset + return queryset.distinct() class LocationViewSet(ReadOnlyModelViewSet):