Skip to content

Commit 28826b8

Browse files
committed
Show problem types column in contest when setting is enabled
1 parent df99fe3 commit 28826b8

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

judge/views/problem.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,8 @@ def profile(self):
408408
return self.request.profile
409409

410410
def get_contest_queryset(self):
411-
queryset = self.profile.current_contest.contest.contest_problems.select_related('problem__group') \
411+
queryset = self.profile.current_contest.contest.contest_problems.select_related('problem') \
412+
.select_related('problem__group') \
412413
.defer('problem__description').order_by('problem__code') \
413414
.annotate(user_count=Count('submission__participation', distinct=True)) \
414415
.annotate(i18n_translation=FilteredRelation(
@@ -425,8 +426,9 @@ def get_contest_queryset(self):
425426
'points': p['points'],
426427
'partial': p['partial'],
427428
'user_count': p['user_count'],
428-
} for p in queryset.values('problem_id', 'problem__code', 'problem__name', 'i18n_name',
429-
'problem__group__full_name', 'points', 'partial', 'user_count')]
429+
'types_list': q.problem.types_list,
430+
} for p, q in zip(queryset.values('problem_id', 'problem__code', 'problem__name', 'i18n_name',
431+
'problem__group__full_name', 'points', 'partial', 'user_count'), queryset)]
430432

431433
@staticmethod
432434
def apply_full_text(queryset, query):
@@ -490,7 +492,9 @@ def get_queryset(self):
490492
def get_context_data(self, **kwargs):
491493
context = super(ProblemList, self).get_context_data(**kwargs)
492494
context['hide_solved'] = 0 if self.in_contest else int(self.hide_solved)
493-
context['show_types'] = 0 if self.in_contest else int(self.show_types)
495+
if self.in_contest:
496+
self.show_types = int(not self.contest.hide_problem_tags)
497+
context['show_types'] = int(self.show_types)
494498
context['has_public_editorial'] = 0 if self.in_contest else int(self.has_public_editorial)
495499
context['full_text'] = 0 if self.in_contest else int(self.full_text)
496500
context['category'] = self.category

0 commit comments

Comments
 (0)