Fix organization submissions

This commit is contained in:
cuom1999 2023-07-06 22:37:43 +07:00
parent a02814621e
commit 1595063463
2 changed files with 8 additions and 7 deletions

View file

@ -453,7 +453,7 @@ class OrganizationSubmissions(
def get_queryset(self):
return (
super()
._get_entire_queryset()
.get_queryset()
.filter(contest_object__organizations=self.organization)
)

View file

@ -322,6 +322,7 @@ class SubmissionsListBase(DiggPaginatorMixin, TitleMixin, ListView):
context_object_name = "submissions"
first_page_href = None
include_frozen = False
organization = None
def get_result_data(self):
result = self._get_result_data()
@ -348,6 +349,10 @@ class SubmissionsListBase(DiggPaginatorMixin, TitleMixin, ListView):
return self.request.profile.current_contest.contest
def _get_entire_queryset(self):
organization = self.organization or self.request.organization
if organization:
queryset = Submission.objects.filter(contest_object__organizations=organization)
else:
queryset = Submission.objects.all()
use_straight_join(queryset)
queryset = submission_related(queryset.order_by("-id"))
@ -412,10 +417,6 @@ class SubmissionsListBase(DiggPaginatorMixin, TitleMixin, ListView):
def get_queryset(self):
queryset = self._get_entire_queryset()
if not self.in_contest:
if self.request.organization:
queryset = queryset.filter(
contest_object__organizations=self.request.organization
)
join_sql_subquery(
queryset,
subquery=str(