more UI changes
parent
9dba8315ca
commit
490d18c7c8
1
app.py
1
app.py
|
@ -77,6 +77,7 @@ def register():
|
||||||
@app.route('/logout/')
|
@app.route('/logout/')
|
||||||
def logout():
|
def logout():
|
||||||
session.pop("team_id")
|
session.pop("team_id")
|
||||||
|
flash("You've successfully logged out.")
|
||||||
return redirect(url_for('root'))
|
return redirect(url_for('root'))
|
||||||
|
|
||||||
# Debugging things
|
# Debugging things
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
form {
|
form {
|
||||||
margin-top: 20px;
|
margin-top: 30px;
|
||||||
margin-bottom: 25px;
|
margin-bottom: 25px;
|
||||||
}
|
}
|
||||||
.bigger {
|
.bigger {
|
||||||
|
@ -32,35 +32,45 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>{{ team.name }}</h2>
|
<h2>{{ team.name }}</h2>
|
||||||
<section>
|
<section>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col s12">
|
||||||
|
<div class="card blue darken-1">
|
||||||
|
<div class="card-content white-text">
|
||||||
|
<span class="card-title">Login information</span>
|
||||||
|
<p>Your team key is <code>{{ team.key }}</code>. Share this with your teammates,
|
||||||
|
and keep it in a safe place. <strong>You need your team key in order to log in.
|
||||||
|
</strong>If you lose it, an organizer can send it to your team email, which is shown below.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<h4>Team information</h4>
|
<h4>Team information</h4>
|
||||||
<p>Your team key is <code>{{ team.key }}</code>. Share this with your teammates,
|
<p>Your score is currently {{ team_score }}. <a href="{{ url_for('challenges') }}">Go solve more challenges!</a></p>
|
||||||
and keep it in a safe place. You need it to log in. If you lose it, an organizer
|
|
||||||
can send it to your team email, which is shown below.</p>
|
|
||||||
<p>Your team email is <code>{{ team.email }}</code>, and you are affiliated with
|
<p>Your team email is <code>{{ team.email }}</code>, and you are affiliated with
|
||||||
{{ team.affiliation }}.</p>
|
{{ team.affiliation }}.</p>
|
||||||
<p>Your team is currently marked {{ "eligible" if team.eligible else "ineligible" }}.</p>
|
<p>Your team is currently marked {{ "eligible" if team.eligible else "ineligible" }}.</p>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<h4>Edit information</h4>
|
<h4>Edit information</h4>
|
||||||
<p>{{ config.eligibility }}</p>
|
|
||||||
<p>If you do not meet these requirements, you are still welcome to play, but you
|
|
||||||
will not be eligible for prizes. By checking the "Eligibility Certification"
|
|
||||||
checkbox below, you are certifying that you meet the prize eligibility
|
|
||||||
requirement. We may request appropriate documentation to verify your eligibility
|
|
||||||
status before sending you prizes.</p>
|
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<label for="team-name">Team Name</label>
|
<label for="team-name">Team Name</label>
|
||||||
<input id="team-name" name="team_name" type="text" value="{{ team.name }}" />
|
<input required id="team-name" name="team_name" type="text" value="{{ team.name }}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<label for="team-email">Team Email</label>
|
<label for="team-email">Team Email</label>
|
||||||
<input id="team-email" name="team_email" type="email" value="{{ team.email }}" />
|
<input required id="team-email" name="team_email" type="email" value="{{ team.email }}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<label for="affiliation">Affiliation</label>
|
<label for="affiliation">Affiliation</label>
|
||||||
<input id="affiliation" name="affiliation" type="text" value="{{ team.affiliation }}" />
|
<input required id="affiliation" name="affiliation" type="text" value="{{ team.affiliation }}" />
|
||||||
</div>
|
</div>
|
||||||
|
<p>{{ config.eligibility }}</p>
|
||||||
|
<p>If you do not meet these requirements, you are still welcome to play, but you
|
||||||
|
will not be eligible for prizes. By checking the "Eligibility Certification"
|
||||||
|
checkbox below, you are certifying that you meet the prize eligibility
|
||||||
|
requirement. We may request appropriate documentation to verify your eligibility
|
||||||
|
status before sending you prizes.</p>
|
||||||
<input id="team-eligibility" name="team_eligibility" type="checkbox"{% if team.eligible %} checked="checked"{% endif %}/>
|
<input id="team-eligibility" name="team_eligibility" type="checkbox"{% if team.eligible %} checked="checked"{% endif %}/>
|
||||||
<label for="team-eligibility">Eligibility Certification</label>
|
<label for="team-eligibility">Eligibility Certification</label>
|
||||||
<input name="_csrf_token" type="hidden" value="{{ csrf_token() }}" />
|
<input name="_csrf_token" type="hidden" value="{{ csrf_token() }}" />
|
||||||
|
@ -72,38 +82,46 @@ status before sending you prizes.</p>
|
||||||
<h4>Score calculation</h4>
|
<h4>Score calculation</h4>
|
||||||
{% if team_solves.count() %}
|
{% if team_solves.count() %}
|
||||||
<h5>Solved problems</h5>
|
<h5>Solved problems</h5>
|
||||||
<table>
|
<div class="row">
|
||||||
<thead>
|
<div class="col s10 offset-s1">
|
||||||
<tr><th>Name</th><th>Category</th><th>Time</th><th>Value</th></tr>
|
<table>
|
||||||
</thead>
|
<thead>
|
||||||
<tbody>
|
<tr><th>Name</th><th>Category</th><th>Time</th><th>Value</th></tr>
|
||||||
{% for solve in team_solves %}
|
</thead>
|
||||||
<tr>
|
<tbody>
|
||||||
<td>{{ solve.challenge.name }}</td>
|
{% for solve in team_solves %}
|
||||||
<td>{{ solve.challenge.category }}</td>
|
<tr>
|
||||||
<td><abbr class="time" title="{{ solve.time }}">{{ solve.time }}</abbr></td>
|
<td>{{ solve.challenge.name }}</td>
|
||||||
<td>{{ solve.challenge.points }}</td>
|
<td>{{ solve.challenge.category }}</td>
|
||||||
{% endfor %}
|
<td><abbr class="time" title="{{ solve.time }}">{{ solve.time }}</abbr></td>
|
||||||
</tbody>
|
<td>{{ solve.challenge.points }}</td>
|
||||||
</table>
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>No problems have been solved.</p>
|
<p>No problems have been solved.</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if team_adjustments.count() %}
|
{% if team_adjustments.count() %}
|
||||||
<h5>Score adjustments</h5>
|
<h5>Score adjustments</h5>
|
||||||
<table>
|
<div class="row">
|
||||||
<thead>
|
<div class="col s10 offset-s1">
|
||||||
<tr><th>Reason</th><th>Value</th></tr>
|
<table>
|
||||||
</thead>
|
<thead>
|
||||||
<tbody>
|
<tr><th>Reason</th><th>Value</th></tr>
|
||||||
{% for adj in team_adjustments %}
|
</thead>
|
||||||
<tr>
|
<tbody>
|
||||||
<td>{{ adj.reason }}</td>
|
{% for adj in team_adjustments %}
|
||||||
<td>{{ adj.value }}</td>
|
<tr>
|
||||||
</tr>
|
<td>{{ adj.reason }}</td>
|
||||||
{% endfor %}
|
<td>{{ adj.value }}</td>
|
||||||
</tbody>
|
</tr>
|
||||||
</table>
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>No score adjustments have been made.</p>
|
<p>No score adjustments have been made.</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -1,30 +1,29 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Register a Team</h2>
|
<h2>Register a Team</h2>
|
||||||
<h3>Important information about {{ config.ctf_name }}</h3>
|
|
||||||
<p>{{ config.eligibility }}</p>
|
|
||||||
<p>If you do not meet these requirements, you are still welcome to play, but you
|
|
||||||
will not be eligible for prizes. By checking the "Eligibility Certification"
|
|
||||||
checkbox below, you are certifying that you meet the prize eligibility
|
|
||||||
requirement. We may request appropriate documentation to verify your eligibility
|
|
||||||
status before sending you prizes.</p>
|
|
||||||
<p>After registering, you will be directed to your team's dashboard. This will
|
<p>After registering, you will be directed to your team's dashboard. This will
|
||||||
contain a "team key", which is used to log in. <strong>Please store your team
|
contain a "team key", which is used to log in.</p>
|
||||||
key in a safe place, and share it with your team members.</strong></p>
|
<p><strong>Please store your team key in a safe place, and share it with your
|
||||||
<h3>Registration form</h3>
|
team members.</strong></p>
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<input id="team-name" name="team_name" type="text" />
|
<input required id="team-name" name="team_name" type="text" />
|
||||||
<label for="team-name">Team Name</label>
|
<label for="team-name">Team Name</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<input id="team-email" name="team_email" type="email" />
|
<input required id="team-email" name="team_email" type="email" />
|
||||||
<label for="team-email">Team Email</label>
|
<label for="team-email">Team Email</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
<input id="affiliation" name="affiliation" type="text" />
|
<input required id="affiliation" name="affiliation" type="text" />
|
||||||
<label for="affiliation">Affiliation</label>
|
<label for="affiliation">Affiliation</label>
|
||||||
</div>
|
</div>
|
||||||
|
<p>{{ config.eligibility }}</p>
|
||||||
|
<p>If you do not meet these requirements, you are still welcome to play, but you
|
||||||
|
will not be eligible for prizes. By checking the "Eligibility Certification"
|
||||||
|
checkbox below, you are certifying that you meet the prize eligibility
|
||||||
|
requirement. We may request appropriate documentation to verify your eligibility
|
||||||
|
status before sending you prizes.</p>
|
||||||
<input id="team-eligibility" name="team_eligibility" type="checkbox" />
|
<input id="team-eligibility" name="team_eligibility" type="checkbox" />
|
||||||
<label for="team-eligibility">Eligibility Certification</label>
|
<label for="team-eligibility">Eligibility Certification</label>
|
||||||
<input name="_csrf_token" type="hidden" value="{{ csrf_token() }}" />
|
<input name="_csrf_token" type="hidden" value="{{ csrf_token() }}" />
|
||||||
|
|
|
@ -42,8 +42,8 @@
|
||||||
<tr><th>Rank</th><th>Team</th><th>Affiliation</th><th>Score</th></tr>
|
<tr><th>Rank</th><th>Team</th><th>Affiliation</th><th>Score</th></tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for eligible, team, affiliation, score in data %}
|
{% for eligible, teamid, 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>
|
<tr class="teamrow {% if not eligible %}in{% endif %}eligible {% if teamid == session.team_id %}blue lighten-3 {% endif %}visible"><td class="rank">{{ rank }}</td><td>{{ team }}</td><td>{{ affiliation }}</td><td>{{ score }}</td></tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
2
utils.py
2
utils.py
|
@ -46,7 +46,7 @@ def calculate_scores():
|
||||||
scores[solve.team_id] += solve.challenge.points
|
scores[solve.team_id] += solve.challenge.points
|
||||||
for adjustment in adjustments:
|
for adjustment in adjustments:
|
||||||
scores[adjustment.team_id] += adjustment.value
|
scores[adjustment.team_id] += adjustment.value
|
||||||
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]])))]
|
return [(team_mapping[i[0]].eligible, i[0], 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):
|
def get_complex(key):
|
||||||
i = g.redis.get(key)
|
i = g.redis.get(key)
|
||||||
|
|
Loading…
Reference in New Issue