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