Skip to content

Commit

Permalink
don't pr this, it conflicts with DMOJ#1645
Browse files Browse the repository at this point in the history
  • Loading branch information
int-y1 committed Dec 19, 2022
1 parent 05a42d8 commit c742bed
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion judge/models/submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def can_see_detail(self, user):
elif source_visibility == SubmissionSourceAccess.SOLVED and \
(self.problem.is_public or self.problem.testers.filter(id=profile.id).exists()) and \
self.problem.submission_set.filter(user_id=profile.id, result='AC',
points=self.problem.points).exists():
points__gte=self.problem.points).exists():
return True
elif source_visibility == SubmissionSourceAccess.ONLY_OWN and \
self.problem.testers.filter(id=profile.id).exists():
Expand Down
4 changes: 2 additions & 2 deletions judge/utils/problems.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ 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'))
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', points__gte=F('problem__points'))
.values_list('problem_id', flat=True).distinct())
cache.set(key, result, 86400)
return result
Expand Down
3 changes: 2 additions & 1 deletion judge/views/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,8 @@ def get_normal_queryset(self):
filter |= Q(testers=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'))
queryset = queryset.exclude(id__in=Submission.objects
.filter(user=self.profile, points__gte=F('problem__points'))
.values_list('problem__id', flat=True))
if self.show_types:
queryset = queryset.prefetch_related('types')
Expand Down

0 comments on commit c742bed

Please sign in to comment.