Fix organization submissions
This commit is contained in:
parent
a02814621e
commit
1595063463
2 changed files with 8 additions and 7 deletions
|
@ -453,7 +453,7 @@ class OrganizationSubmissions(
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
return (
|
return (
|
||||||
super()
|
super()
|
||||||
._get_entire_queryset()
|
.get_queryset()
|
||||||
.filter(contest_object__organizations=self.organization)
|
.filter(contest_object__organizations=self.organization)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -322,6 +322,7 @@ class SubmissionsListBase(DiggPaginatorMixin, TitleMixin, ListView):
|
||||||
context_object_name = "submissions"
|
context_object_name = "submissions"
|
||||||
first_page_href = None
|
first_page_href = None
|
||||||
include_frozen = False
|
include_frozen = False
|
||||||
|
organization = None
|
||||||
|
|
||||||
def get_result_data(self):
|
def get_result_data(self):
|
||||||
result = self._get_result_data()
|
result = self._get_result_data()
|
||||||
|
@ -348,6 +349,10 @@ class SubmissionsListBase(DiggPaginatorMixin, TitleMixin, ListView):
|
||||||
return self.request.profile.current_contest.contest
|
return self.request.profile.current_contest.contest
|
||||||
|
|
||||||
def _get_entire_queryset(self):
|
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()
|
queryset = Submission.objects.all()
|
||||||
use_straight_join(queryset)
|
use_straight_join(queryset)
|
||||||
queryset = submission_related(queryset.order_by("-id"))
|
queryset = submission_related(queryset.order_by("-id"))
|
||||||
|
@ -412,10 +417,6 @@ class SubmissionsListBase(DiggPaginatorMixin, TitleMixin, ListView):
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
queryset = self._get_entire_queryset()
|
queryset = self._get_entire_queryset()
|
||||||
if not self.in_contest:
|
if not self.in_contest:
|
||||||
if self.request.organization:
|
|
||||||
queryset = queryset.filter(
|
|
||||||
contest_object__organizations=self.request.organization
|
|
||||||
)
|
|
||||||
join_sql_subquery(
|
join_sql_subquery(
|
||||||
queryset,
|
queryset,
|
||||||
subquery=str(
|
subquery=str(
|
||||||
|
|
Loading…
Reference in a new issue