Skip to content
Snippets Groups Projects
Commit 28cf7278 authored by Jiří Setnička's avatar Jiří Setnička
Browse files

Dělená kola v účastnické části webu

Issue #178
parent c2d250fa
No related branches found
No related tags found
1 merge request!48Dělená kola napotřetí
......@@ -52,27 +52,27 @@
{% endif %}
<h3>Účast v kolech</h3>
{% if rounds.count() %}
{% if participations %}
<table class="data full">
<thead>
<tr>
<th>Ročník<th>Kategorie<th>Kolo<th>Místo<th>Stav účasti<th>Odkazy
</tr>
</thead>
{% for round in rounds %}
{% for (pion, contest, round) in participations %}
<tr>
<td>{{ round.contest.round.year }}
<td>{{ round.contest.round.category }}
<td>{{ round.contest.round.seq }}
<td><a href="{{ url_for('org_place', id=round.contest.place_id) }}">{{ round.contest.place.name }}</a>
{% if round.place_id != round.contest.place_id %}
<br>(ale soutěží v <a href="{{ url_for('org_place', id=round.place_id) }}">{{ round.place.name }}</a>)
<td>{{ round.year }}
<td>{{ round.category }}
<td>{{ round.seq }}{{ round.part_code() }}
<td><a href="{{ url_for('org_place', id=contest.place_id) }}">{{ contest.place.name }}</a>
{% if pion.place_id != contest.place_id %}
<br>(ale soutěží v <a href="{{ url_for('org_place', id=pion.place_id) }}">{{ pion.place.name }}</a>)
{% endif %}
<td>{{ round.state.friendly_name() }}
<td><div class="btn-group">
<a class="btn btn-xs btn-primary" href="{{ url_for('org_contest_user', contest_id=round.contest.contest_id, user_id=user.user_id) }}">Odevzdané úlohy</a>
<a class="btn btn-xs btn-default" href="{{ url_for('org_contest', id=round.contest.contest_id) }}">Stránka soutěže</a>
<a class="btn btn-xs btn-default" href="{{ url_for('org_round', id=round.contest.round.round_id) }}">Stránka kola</a>
<a class="btn btn-xs btn-primary" href="{{ url_for('org_contest_user', contest_id=contest.contest_id, user_id=user.user_id) }}">Odevzdané úlohy</a>
<a class="btn btn-xs btn-default" href="{{ url_for('org_contest', id=contest.contest_id) }}">Stránka soutěže</a>
<a class="btn btn-xs btn-default" href="{{ url_for('org_round', id=round.round_id) }}">Stránka kola</a>
{% if g.user.is_admin %}
<a class="btn btn-xs btn-default" href="{{ log_url('participant', user.user_id) }}">Historie</a>
{% endif %}
......
......@@ -22,11 +22,11 @@ def user_index():
pions = (sess.query(db.Participation, db.Contest, db.Round)
.select_from(db.Participation)
.join(db.Contest)
.join(db.Contest, db.Contest.master_contest_id == db.Participation.contest_id)
.join(db.Round)
.filter(db.Participation.user == g.user)
.options(joinedload(db.Contest.place))
.order_by(db.Round.year.desc(), db.Round.category, db.Round.seq)
.order_by(db.Round.year.desc(), db.Round.category, db.Round.seq, db.Round.part)
.all())
return render_template(
......@@ -46,7 +46,7 @@ def get_contest(id: int) -> db.Contest:
# FIXME: Kontrolovat nějak pion.state?
pion = (db.get_session().query(db.Participation)
.filter_by(user=g.user, contest=contest)
.filter_by(user=g.user, contest_id=contest.master_contest_id)
.one_or_none())
if not pion:
raise werkzeug.exceptions.Forbidden()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment