Optimize a query

This commit is contained in:
cuom1999 2023-01-27 17:58:44 -06:00
parent bd05ba6b78
commit 03455fca2c

View file

@ -588,11 +588,8 @@ class ProblemList(QueryStringSortMixin, TitleMixin, SolvedProblemMixin, ListView
queryset = Problem.get_visible_problems(self.request.user)
queryset = queryset.select_related("group")
if self.profile is not None and self.hide_solved:
queryset = queryset.exclude(
id__in=Submission.objects.filter(
user=self.profile, points=F("problem__points")
).values_list("problem__id", flat=True)
)
solved_problems = self.get_completed_problems()
queryset = queryset.exclude(id__in=solved_problems)
if not self.org_query and self.request.organization:
self.org_query = [self.request.organization.id]
if self.org_query: