Optimize a query

This commit is contained in:
cuom1999 2023-01-23 20:55:07 -06:00
parent dc243dc136
commit 2270730407
2 changed files with 3 additions and 2 deletions

View file

@ -477,7 +477,7 @@ class OrganizationSubmissions(
return ( return (
super() super()
._get_entire_queryset() ._get_entire_queryset()
.filter(user__organizations=self.organization, problem__in=problems) .filter(user__in=self.organization.members.all(), problem__in=problems)
) )
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):

View file

@ -420,7 +420,8 @@ class SubmissionsListBase(DiggPaginatorMixin, TitleMixin, ListView):
self.request, self.request.organization self.request, self.request.organization
) )
queryset = queryset.filter( queryset = queryset.filter(
user__organizations=self.request.organization, problem__in=problems user__in=self.request.organization.members.all(),
problem__in=problems,
) )
join_sql_subquery( join_sql_subquery(
queryset, queryset,