From 13c8c29bb0be85ef39c97607268739c606856245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Mon, 13 Feb 2023 20:47:42 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20dvojn=C3=A1sobky=20v=20tabulce=20do?= =?UTF-8?q?=C5=A1l=C3=BDch=20=C5=99e=C5=A1en=C3=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- odevzdavatko/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odevzdavatko/views.py b/odevzdavatko/views.py index 9ac1ac29..c5a93fe1 100644 --- a/odevzdavatko/views.py +++ b/odevzdavatko/views.py @@ -114,7 +114,7 @@ class TabulkaOdevzdanychReseniView(ListView): qs = super().get_queryset() if self.jen_neobodovane: qs = qs.filter(body__isnull=True) - qs = qs.filter(problem__in=self.problemy, reseni__in=self.reseni, reseni__resitele__in=self.resitele).select_related('reseni', 'problem').prefetch_related('reseni__resitele__osoba') + qs = qs.filter(problem__in=self.problemy, reseni__in=self.reseni, reseni__resitele__in=self.resitele).select_related('reseni', 'problem').prefetch_related('reseni__resitele__osoba').distinct() # FIXME tohle je ošklivé, na špatném místě a pomalé. Ale moc mě štvalo, že musím hledat správná místa v tabulce. self.problemy = self.problemy.filter(id__in=qs.values("problem__id")) return qs