Optimize a query
This commit is contained in:
parent
bd05ba6b78
commit
03455fca2c
1 changed files with 2 additions and 5 deletions
|
@ -588,11 +588,8 @@ class ProblemList(QueryStringSortMixin, TitleMixin, SolvedProblemMixin, ListView
|
||||||
queryset = Problem.get_visible_problems(self.request.user)
|
queryset = Problem.get_visible_problems(self.request.user)
|
||||||
queryset = queryset.select_related("group")
|
queryset = queryset.select_related("group")
|
||||||
if self.profile is not None and self.hide_solved:
|
if self.profile is not None and self.hide_solved:
|
||||||
queryset = queryset.exclude(
|
solved_problems = self.get_completed_problems()
|
||||||
id__in=Submission.objects.filter(
|
queryset = queryset.exclude(id__in=solved_problems)
|
||||||
user=self.profile, points=F("problem__points")
|
|
||||||
).values_list("problem__id", flat=True)
|
|
||||||
)
|
|
||||||
if not self.org_query and self.request.organization:
|
if not self.org_query and self.request.organization:
|
||||||
self.org_query = [self.request.organization.id]
|
self.org_query = [self.request.organization.id]
|
||||||
if self.org_query:
|
if self.org_query:
|
||||||
|
|
Loading…
Reference in a new issue