AACResults/templates/search.html

81 lines
3.1 KiB
HTML

{% set ns = namespace() -%}
{% include 'head.html' with context %}
<article>
<h1>AAC Statistics {% if title %}: {{ title }}{% endif %}{% if year %} {{ year }}{% endif %}</h1>
<form class="search">
<div class="search">
<div>
<label for="searchname">Name</label>
<input type="text" id="searchname" name="name" value="{{ request.args.get('name', '') }}" />
</div>
<div>
<label for="searchlicence">Licence</label>
<input type="text" id="searchlicence" name="licence" value="{{ request.args.get('licence', '') }}" />
</div>
<div>
<label for="searchafter">Older than</label>
<input type="date" id="searchafter" name="after" max="" value="{{ request.args.get('after', '') }}" />
</div>
<div>
<label for="searchbefore">Newer than</label>
<input type="date" id="searchbefore" name="before" min="" value="{{ request.args.get('before', '') }}" />
</div>
<div>
<label for="searchevent">Race</label>
<input type="text" id="searchevent" name="event" value="{{ request.args.get('event', '') }}" />
</div>
<!--div>
<label for="searchposition">Position</label>
<input type="text" id="searchposition" name="position" value="{{ request.args.get('position', '') }}" />
</div-->
<div><input type="submit" id="searchsubmit" name="submit" /></div>
</div>
</form>
{% if results -%}
{%- set ns.total = 0 -%}
{%- if 'count' in results -%}
{%- set ns.total = results['count'] -%}
{%- endif -%}
<table>
<thead>
<tr>
<th>Position</th>
<th>Name</th>
<th>Licence</th>
<th>Time</th>
<th>Average Pace</th>
<th>Event</th>
<th>Date</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
{%- for row in results['rows'] -%}
{%- set person='{} {}'.format(row.name, row.surname) -%}
{%- if distance %}{# set total_km += row.distance #}{% endif -%}
<tr>
<td>{{ row.position }}</td>
<td><a href="{{ url_for('person', title=person, start=None) }}">{{ person }}</a></td>
<td><a href="{{ url_for('licence', title=row.licence, year=row.date|year, start=None, limit=ns.limit) }}">{{ row.licence }}</a></td>
<td>{{ row.time }}</td>
<td class="nowrap">{% if row.distance is number %}{{ (row.time / row.distance) | pace }} min/KM{% endif %}</td>
<td><a href="{{ url_for('race', title=row.event, year=row.date|year, start=None, limit=ns.limit) }}">{{ row.event }} ({{ row.distance }} KM)</a></td>
<td>{{ row.date | cleandate }}</td>
<td>
{%- if row.sex and row.sexposition and row.sexposition | int <= 100 %}{{ row.sexposition | ordinal }} {{ row.sex.lower() }}{% 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 }} in category{% endif -%}
</td>
</tr>
{%- endfor -%}
</tbody>
</table>
{%- endif %}
</article>
<footer>
{% include 'prevnext.html' with context %}
</footer>
</body>
</html>