Skip to content
Snippets Groups Projects
Commit a8b775d6 authored by Martin Mareš's avatar Martin Mareš
Browse files

Merge branch 'jk/issue-213' into 'devel'

Odkazy na soutěže z míst

See merge request !79
parents ad1e354c 658a072c
No related branches found
No related tags found
1 merge request!79Odkazy na soutěže z míst
......@@ -32,11 +32,19 @@ def org_place(id: int):
children = sorted(place.children, key=lambda p: locale.strxfrm(p.name))
rr = g.gatekeeper.rights_for(place)
contests = (sess.query(db.Contest)
.options(joinedload(db.Contest.round))
.filter_by(place=place)
.all())
contests.sort(key=lambda c: (-c.round.year, c.round.category, c.round.seq, c.round.part))
return render_template(
'org_place.html', place=place, school=school,
can_edit=rr.can_edit_place(place),
can_add_child=rr.can_add_place_child(place),
children=children
children=children,
contests=contests
)
......
......@@ -55,4 +55,29 @@
<a class="btn btn-primary" href="{{ url_for('org_place_new_child', id=place.place_id) }}">Přidat nové podřízené místo</a>
{% endif %}
{% endif %}
<h3>Soutěže</h3>
{% if not contests %}
<p>K tomuto místu nejsou přidružené žádné soutěže.
{% else %}
<table class=data>
<thead><tr>
<th>ID
<th>Ročník
<th>Kat.
<th>Název
<th>Stav
</thead>
{% for c in contests %}
<tr>
{% set r = c.round %}
<td><a href='{{ url_for('org_contest', id=c.contest_id) }}'>{{ r.round_code() }}</a>
<td>{{ r.year }}
<td>{{ r.category }}
<td>{{ r.name }}
<td class='rstate-{{c.state.name}}'>{{ c.state.friendly_name() }}
{% endfor %}
</table>
{% endif %}
{% endblock %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment