Fix rerate logic (DMOJ)
This commit is contained in:
parent
297b8a2a36
commit
b45de198ba
10 changed files with 77 additions and 78 deletions
|
@ -591,7 +591,7 @@ class ContestStats(TitleMixin, ContestMixin, DetailView):
|
|||
|
||||
ContestRankingProfile = namedtuple(
|
||||
'ContestRankingProfile',
|
||||
'id user css_class username points cumtime organization participation '
|
||||
'id user css_class username points cumtime tiebreaker organization participation '
|
||||
'participation_rating problem_cells result_cell',
|
||||
)
|
||||
|
||||
|
@ -607,6 +607,7 @@ def make_contest_ranking_profile(contest, participation, contest_problems):
|
|||
username=user.username,
|
||||
points=participation.score,
|
||||
cumtime=participation.cumtime,
|
||||
tiebreaker=participation.tiebreaker,
|
||||
organization=user.organization,
|
||||
participation_rating=participation.rating.rating if hasattr(participation, 'rating') else None,
|
||||
problem_cells=[contest.format.display_user_problem(participation, contest_problem)
|
||||
|
@ -622,17 +623,17 @@ def base_contest_ranking_list(contest, problems, queryset):
|
|||
|
||||
|
||||
def contest_ranking_list(contest, problems):
|
||||
return base_contest_ranking_list(contest, problems, contest.users.filter(virtual=0, user__is_unlisted=False)
|
||||
return base_contest_ranking_list(contest, problems, contest.users.filter(virtual=0)
|
||||
.prefetch_related('user__organizations')
|
||||
.extra(select={'round_score': 'round(score, 6)'})
|
||||
.order_by('is_disqualified', '-round_score', 'cumtime'))
|
||||
.order_by('is_disqualified', '-round_score', 'cumtime', 'tiebreaker'))
|
||||
|
||||
|
||||
def get_contest_ranking_list(request, contest, participation=None, ranking_list=contest_ranking_list,
|
||||
show_current_virtual=True, ranker=ranker):
|
||||
problems = list(contest.contest_problems.select_related('problem').defer('problem__description').order_by('order'))
|
||||
|
||||
users = ranker(ranking_list(contest, problems), key=attrgetter('points', 'cumtime'))
|
||||
users = ranker(ranking_list(contest, problems), key=attrgetter('points', 'cumtime', 'tiebreaker'))
|
||||
|
||||
if show_current_virtual:
|
||||
if participation is None and request.user.is_authenticated:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue