Skip to content

Commit

Permalink
Update public ranking code
Browse files Browse the repository at this point in the history
  • Loading branch information
leduythuccs committed Dec 13, 2024
1 parent b605117 commit 5d60b9c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion judge/views/contests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,13 +1059,16 @@ def get_ranking_list(self):
# ignore the `can_see_full_scoreboard` check
return self.get_full_ranking_list()

def get_object(self, queryset=None):
return DetailView.get_object(self, queryset)

def get(self, request, *args, **kwargs):
self.object = self.get_object()

ranking_stop_last_minutes = self.object.ranking_stop_last_minutes
time_left_seconds = (self.object.end_time - self.object._now).total_seconds()

if time_left_seconds < ranking_stop_last_minutes * 60:
if ranking_stop_last_minutes > 0 and time_left_seconds < ranking_stop_last_minutes * 60:
return generic_message(request, _('Access past the allowed time'),
_(f'You are not allowed to view the ranking in the last {ranking_stop_last_minutes} minutes.'))

Expand Down

0 comments on commit 5d60b9c

Please sign in to comment.