Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show Problem Types In Contest When Enabled #2327

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions judge/views/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,8 @@ def profile(self):
return self.request.profile

def get_contest_queryset(self):
queryset = self.profile.current_contest.contest.contest_problems.select_related('problem__group') \
queryset = self.profile.current_contest.contest.contest_problems.select_related('problem') \
.select_related('problem__group') \
.defer('problem__description').order_by('problem__code') \
.annotate(user_count=Count('submission__participation', distinct=True)) \
.annotate(i18n_translation=FilteredRelation(
Expand All @@ -425,8 +426,9 @@ def get_contest_queryset(self):
'points': p['points'],
'partial': p['partial'],
'user_count': p['user_count'],
} for p in queryset.values('problem_id', 'problem__code', 'problem__name', 'i18n_name',
'problem__group__full_name', 'points', 'partial', 'user_count')]
'types_list': q.problem.types_list,
} for p, q in zip(queryset.values('problem_id', 'problem__code', 'problem__name', 'i18n_name',
'problem__group__full_name', 'points', 'partial', 'user_count'), queryset)]
tandr3w marked this conversation as resolved.
Show resolved Hide resolved

@staticmethod
def apply_full_text(queryset, query):
Expand Down Expand Up @@ -490,7 +492,9 @@ def get_queryset(self):
def get_context_data(self, **kwargs):
context = super(ProblemList, self).get_context_data(**kwargs)
context['hide_solved'] = 0 if self.in_contest else int(self.hide_solved)
context['show_types'] = 0 if self.in_contest else int(self.show_types)
tandr3w marked this conversation as resolved.
Show resolved Hide resolved
if self.in_contest:
self.show_types = int(not self.contest.hide_problem_tags)
context['show_types'] = int(self.show_types)
context['has_public_editorial'] = 0 if self.in_contest else int(self.has_public_editorial)
context['full_text'] = 0 if self.in_contest else int(self.full_text)
context['category'] = self.category
Expand Down
Loading