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 = 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:
|
||||
|
|
Loading…
Reference in a new issue