ineligible toggle
parent
092a2a5327
commit
4ce0c47fe2
|
@ -20,7 +20,7 @@ function toggle() {
|
|||
<p>You are scoring on behalf of {{ team.name }}. If this is incorrect, you should
|
||||
<a href="{{ url_for('logout') }}">logout</a> and login with the correct team key.</p>
|
||||
<a href="javascript:toggle()">Toggle collapsed state</a>
|
||||
<ul class="collapsible" data-collapsible="expandable">
|
||||
<ul class="collapsible popout" data-collapsible="expandable">
|
||||
{% for challenge in challenges %}
|
||||
<li>
|
||||
<div class="collapsible-header{% if challenge not in solved %} active{% endif %}">
|
||||
|
|
|
@ -1,14 +1,49 @@
|
|||
{% extends "base.html" %}
|
||||
{% block title %}Scoreboard{% endblock %}
|
||||
{% block head %}
|
||||
<style type="text/css">
|
||||
.teamrow:not(.visible) {
|
||||
display: none;
|
||||
}
|
||||
.teamrow.ineligible {
|
||||
color: #bbb;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var ineligibleShown = true;
|
||||
function recalcRanks() {
|
||||
$(".teamrow.visible").each(function(i, x) {
|
||||
$(x).children(".rank").html(i + 1);
|
||||
});
|
||||
}
|
||||
function hideIneligible() {
|
||||
$(".teamrow.ineligible").removeClass("visible");
|
||||
recalcRanks();
|
||||
}
|
||||
function showIneligible() {
|
||||
$(".teamrow.ineligible").addClass("visible");
|
||||
recalcRanks();
|
||||
}
|
||||
function toggleIneligible() {
|
||||
if(ineligibleShown) hideIneligible();
|
||||
else showIneligible();
|
||||
ineligibleShown = !ineligibleShown;
|
||||
}
|
||||
document.onready = function() {
|
||||
recalcRanks();
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<h2>Scoreboard</h2>
|
||||
<a href="javascript:toggleIneligible()">Toggle ineligible team display</a>
|
||||
<table>
|
||||
<thead>
|
||||
<tr><th>Rank</th><th>Team</th><th>Affiliation</th><th>Score</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for eligible, rank, team, affiliation, score in data %}
|
||||
<tr style="color: {{ "black" if eligible else "#bbb" }}"><td>{{ rank }}</td><td>{{ team }}</td><td>{{ affiliation }}</td><td>{{ score }}</td></tr>
|
||||
{% for eligible, team, affiliation, score in data %}
|
||||
<tr class="teamrow {% if not eligible %}in{% endif %}eligible visible"><td class="rank">{{ rank }}</td><td>{{ team }}</td><td>{{ affiliation }}</td><td>{{ score }}</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
2
utils.py
2
utils.py
|
@ -46,7 +46,7 @@ def calculate_scores():
|
|||
scores[solve.team_id] += solve.challenge.points
|
||||
for adjustment in adjustments:
|
||||
scores[adjustment.team_id] += adjustment.value
|
||||
return [(team_mapping[i[0]].eligible, idx + 1, team_mapping[i[0]].name, team_mapping[i[0]].affiliation, i[1]) for idx, i in enumerate(sorted(scores.items(), key=lambda k: (-k[1], most_recent_solve[k[0]])))]
|
||||
return [(team_mapping[i[0]].eligible, team_mapping[i[0]].name, team_mapping[i[0]].affiliation, i[1]) for idx, i in enumerate(sorted(scores.items(), key=lambda k: (-k[1], most_recent_solve[k[0]])))]
|
||||
|
||||
def get_complex(key):
|
||||
i = g.redis.get(key)
|
||||
|
|
Loading…
Reference in New Issue