Skip to content

Commit

Permalink
Fix filtering problems by full AC
Browse files Browse the repository at this point in the history
  • Loading branch information
int-y1 authored and kiritofeng committed Aug 23, 2023
1 parent 89fec36 commit ee60a17
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions judge/utils/problems.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def contest_completed_ids(participation):
key = 'contest_complete:%d' % participation.id
result = cache.get(key)
if result is None:
result = set(participation.submissions.filter(submission__result='AC', points=F('problem__points'))
.values_list('problem__problem__id', flat=True).distinct())
result = set(participation.submissions.filter(submission__result='AC', points__gte=F('problem__points'))
.values_list('problem__problem_id', flat=True).distinct())
cache.set(key, result, 86400)
return result

Expand All @@ -34,7 +34,7 @@ def user_completed_ids(profile):
key = 'user_complete:%d' % profile.id
result = cache.get(key)
if result is None:
result = set(Submission.objects.filter(user=profile, result='AC', points=F('problem__points'))
result = set(Submission.objects.filter(user=profile, result='AC', case_points__gte=F('case_total'))
.values_list('problem_id', flat=True).distinct())
cache.set(key, result, 86400)
return result
Expand Down
5 changes: 3 additions & 2 deletions judge/views/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,9 @@ def get_normal_queryset(self):
filter = Problem.q_add_author_curator_tester(filter, self.profile)
queryset = Problem.objects.filter(filter).select_related('group').defer('description', 'summary')
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))
queryset = queryset.exclude(id__in=Submission.objects
.filter(user=self.profile, result='AC', case_points__gte=F('case_total'))
.values_list('problem_id', flat=True))
if self.show_types:
queryset = queryset.prefetch_related('types')
queryset = queryset.annotate(has_public_editorial=Case(
Expand Down

0 comments on commit ee60a17

Please sign in to comment.