Fix editorial bug in problem view
This commit is contained in:
parent
9ad1052766
commit
ae9ef37e3a
1 changed files with 5 additions and 5 deletions
|
@ -395,6 +395,11 @@ class ProblemList(QueryStringSortMixin, TitleMixin, SolvedProblemMixin, ListView
|
|||
queryset = queryset.filter(points__gte=self.point_start)
|
||||
if self.point_end is not None:
|
||||
queryset = queryset.filter(points__lte=self.point_end)
|
||||
if self.show_editorial:
|
||||
queryset = queryset.annotate(
|
||||
has_public_editorial=Sum(Case(When(solution__is_public=True, then=1),
|
||||
default=0, output_field=IntegerField())))
|
||||
|
||||
return queryset.distinct()
|
||||
|
||||
def get_queryset(self):
|
||||
|
@ -410,11 +415,6 @@ class ProblemList(QueryStringSortMixin, TitleMixin, SolvedProblemMixin, ListView
|
|||
context['full_text'] = 0 if self.in_contest else int(self.full_text)
|
||||
context['show_editorial'] = 0 if self.in_contest else int(self.show_editorial)
|
||||
|
||||
if (context['show_editorial']):
|
||||
context['object_list'] = context['object_list'] \
|
||||
.annotate(has_public_editorial=Sum(Case(When(solution__is_public=True, then=1),
|
||||
default=0, output_field=IntegerField())))
|
||||
|
||||
context['category'] = self.category
|
||||
context['categories'] = ProblemGroup.objects.all()
|
||||
if self.show_types:
|
||||
|
|
Loading…
Reference in a new issue