AACResults/templates/index.html

62 lines
2.8 KiB
HTML

{% set ns = namespace() -%}
{% include 'head.html' with context %}
<article>
{% if ltype == 'search' -%}
<h1>AAC Results: Search</h1>
{% include 'search.html' with context %}
{% else %}
<h1>AAC Results{% if title %}: {% if ltype == 'licence' %}Licence {% endif %}{{ title }}{% endif %}{% if year %} ({{ year }}){% endif %}</h1>
{%- endif -%}
{% if results -%}
{%- set ns.total = 0 -%}
{%- if 'count' in results -%}
{%- set ns.total = results['count'] -%}
{%- endif -%}
<table class="wide">
<thead>
<tr>
<th>Position</th>
<th>Name</th>
<th>Licence</th>
<th>Time</th>
<th>Average Pace</th>
{% if ltype != 'event' %}
<th>Race</th>
{% endif %}
<th>Date</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
{%- for row in results['rows'] -%}
{%- set person = '{} {}'.format(row.name or '', row.surname or '') -%}
<tr>
<td class="nowrap"><span class="label">Position</span> <span>{{ row.position|e }}{% if row.finishers %} / {{ row.finishers }}{% endif %}</span></td>
<td class="nowrap"><span class="label">Name</span> <span><a href="{{ url_for('person', title=person|trim|urlescape, start=None) }}">{{ person|trim|e }}</a></span></td>
<td class="nowrap"><span class="label">Licence</span> <span>{% if row.licence %}<a href="{{ url_for('licence', title=row.licence|trim|urlescape, year=row.date|year, start=None, show=ns.show) }}">{{ row.licence|trim|e }}</a>{% endif %}</span></td>
<td><span class="label">Time</span> <span>{{ row.time|e }}</span></td>
<td class="nowrap"><span class="label">Average Pace</span> <span>{% if row.distance is number and row.distance|float != 0 %}{{ (row.time / row.distance|float) | pace }} min/KM{% endif %}</span></td>
{%- if ltype != 'event' -%}
<td class="long"><span class="label">Race</span> <span><a href="{{ url_for('races', title=row.event|trim|urlescape, year=row.date|year, start=None, show=ns.show) }}">{{ row.event|trim|e }} ({{ row.distance|trim|e }} KM)</a></span></td>
{%- endif -%}
<td class="nowrap"><span class="label">Date</span> <span>{{ row.date|cleandate|e }}</span></td>
<td class="long"><span class="label">Notes</span> <span>
{%- if row.sex and row.sexposition and row.sexposition | int <= 100 %}{{ row.sexposition|ordinal|e }} {{ row.sex|lower|gender|e }}{% endif -%}
{%- if row.sexposition and row.sexposition | int <= 100 and row.catposition and row.catposition | int <= 100 %} and {% endif -%}
{%- if row.catposition and row.catposition | int <= 100 %}{{ row.catposition|ordinal|e }} in category{% endif -%}
</span>
</td>
</tr>
{%- endfor -%}
</tbody>
</table>
{%- endif %}
</article>
<footer>
{% include 'prevnext.html' with context %}
</footer>
</body>
</html>