Skip to content

Commit

Permalink
Merge pull request DMOJ#12 from Ninjaclasher/cboj-10
Browse files Browse the repository at this point in the history
Allow administrators to view all problems in the non-admin problem page
  • Loading branch information
zecookiez authored Nov 13, 2020
2 parents b93f5a7 + 700e97e commit aacbdc3
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions judge/views/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,17 +357,8 @@ def get_contest_queryset(self):
'problem__group__full_name', 'points', 'partial', 'user_count')]

def get_normal_queryset(self):
filter = Q(is_public=True)
if self.profile is not None:
filter |= Q(authors=self.profile)
filter |= Q(curators=self.profile)
filter |= Q(testers=self.profile)
queryset = Problem.objects.filter(filter).select_related('group').defer('description', 'summary')
if not self.request.user.has_perm('see_organization_problem'):
filter = Q(is_organization_private=False)
if self.profile is not None:
filter |= Q(organizations__in=self.profile.organizations.all())
queryset = queryset.filter(filter)
queryset = Problem.get_visible_problems(self.request.user).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))
Expand Down

0 comments on commit aacbdc3

Please sign in to comment.