mirror of
https://github.com/QingdaoU/OnlineJudge.git
synced 2025-11-04 14:49:58 +08:00
增加*开头的队伍不参与排名的规则
This commit is contained in:
parent
4737e970f5
commit
020d17a75a
@ -455,6 +455,12 @@ def _get_rank(contest_id):
|
|||||||
order_by("-total_ac_number", "total_time"). \
|
order_by("-total_ac_number", "total_time"). \
|
||||||
values("id", "user__id", "user__username", "user__real_name", "user__userprofile__student_id",
|
values("id", "user__id", "user__username", "user__real_name", "user__userprofile__student_id",
|
||||||
"contest_id", "submission_info", "total_submission_number", "total_ac_number", "total_time")
|
"contest_id", "submission_info", "total_submission_number", "total_ac_number", "total_time")
|
||||||
|
rank_number = 1
|
||||||
|
for item in rank:
|
||||||
|
# 只有有ac的题目而且不是打星的队伍才参与排名
|
||||||
|
if item["total_ac_number"] > 0 and item["user__username"][0] != "*":
|
||||||
|
item["rank_number"] = rank_number
|
||||||
|
rank_number += 1
|
||||||
return rank
|
return rank
|
||||||
|
|
||||||
|
|
||||||
@ -478,6 +484,11 @@ def contest_rank_page(request, contest_id):
|
|||||||
else:
|
else:
|
||||||
rank = json.loads(rank)
|
rank = json.loads(rank)
|
||||||
|
|
||||||
|
# 2016-05-19 增加了缓存项目,以前的缓存主动失效
|
||||||
|
if "rank_number" not in rank[0]:
|
||||||
|
rank = _get_rank(contest_id)
|
||||||
|
r.set(cache_key, json.dumps([dict(item) for item in rank]))
|
||||||
|
|
||||||
return render(request, "oj/contest/contest_rank.html",
|
return render(request, "oj/contest/contest_rank.html",
|
||||||
{"rank": rank, "contest": contest,
|
{"rank": rank, "contest": contest,
|
||||||
"contest_problems": contest_problems,
|
"contest_problems": contest_problems,
|
||||||
|
|||||||
@ -47,7 +47,7 @@
|
|||||||
<tbody class="rank">
|
<tbody class="rank">
|
||||||
{% for item in rank %}
|
{% for item in rank %}
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{% if item.total_ac_number %}{{ forloop.counter}}{% else %}-{% endif %}</th>
|
<th scope="row">{% if item.rank_number %}{{ item.rank_number }}{% else %}-{% endif %}</th>
|
||||||
<td>
|
<td>
|
||||||
<a href="/contest/{{ contest.id }}/submissions/?user_id={{ item.user__id }}">
|
<a href="/contest/{{ contest.id }}/submissions/?user_id={{ item.user__id }}">
|
||||||
{{ item.user__username }}
|
{{ item.user__username }}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user