Use cached airport list

pull/78/head
Konstantin Gründger 2019-04-03 20:59:25 +02:00
rodzic 9e56bc7844
commit 5f50d33cdf
3 zmienionych plików z 5 dodań i 7 usunięć

Wyświetl plik

@ -127,9 +127,7 @@ def airports():
countries = get_countries_in_logbook()
if sel_country:
airports = db.session.query(Airport) \
.filter(Airport.country_code == sel_country) \
.order_by(Airport.name)
airports = get_airports_in_country(sel_country)
else:
airports = []

Wyświetl plik

@ -30,8 +30,8 @@
{% for airport in airports %}
<tr>
<td>{{ loop.index }}
<td><img src="{{ url_for('static', filename='img/Transparent.gif') }}" class="flag flag-{{ airport.country_code|lower }}" alt="{{ airport.country_code }}"/> <a href="{{ url_for('airport_detail', airport=airport.id) }}">{{ airport.name }}</a></td>
<td><a href="{{ url_for('logbook', airport=airport.id) }}">Logbook</a></td>
<td><img src="{{ url_for('static', filename='img/Transparent.gif') }}" class="flag flag-{{ sel_country|lower }}" alt="{{ sel_country }}"/> <a href="{{ url_for('airport_detail', airport=airport.id) }}">{{ airport.name }}</a></td>
<td><a href="{{ url_for('logbook', country=sel_country, airport=airport.id) }}">Logbook</a></td>
</tr>
{% endfor %}
</table>

Wyświetl plik

@ -61,8 +61,8 @@
<td>{% if entry.duration is not none %}{{ entry.duration }}{% endif %}</td>
<td>{% if entry.max_altitude is not none %}{{ '%0.1f'|format(entry.max_altitude - entry.takeoff_airport.altitude) }} m{% endif %}</td>
<td>
{% if entry.takeoff_airport is not none and entry.takeoff_airport.id != sel_airport %}Take Off: <img src="{{ url_for('static', filename='img/Transparent.gif') }}" class="flag flag-{{ entry.takeoff_airport.country_code|lower }}" alt="{{ entry.takeoff_airport.country_code }}"/> <a href="{{ url_for('logbook', airport=entry.takeoff_airport.id) }}">{{ entry.takeoff_airport.name }}</a>
{% elif entry.landing_airport is not none and entry.landing_airport.id != sel_airport %}Landing: <img src="{{ url_for('static', filename='img/Transparent.gif') }}" class="flag flag-{{ entry.landing_airport.country_code|lower }}" alt="{{ entry.landing_airport.country_code }}"/> <a href="{{ url_for('logbook', airport=entry.landing_airport.id) }}">{{ entry.landing_airport.name }}</a>
{% if entry.takeoff_airport is not none and entry.takeoff_airport.id != sel_airport %}Take Off: <img src="{{ url_for('static', filename='img/Transparent.gif') }}" class="flag flag-{{ entry.takeoff_airport.country_code|lower }}" alt="{{ entry.takeoff_airport.country_code }}"/> <a href="{{ url_for('logbook', country=entry.takeoff_airport.country_code, airport=entry.takeoff_airport.id, date=sel_date) }}">{{ entry.takeoff_airport.name }}</a>
{% elif entry.landing_airport is not none and entry.landing_airport.id != sel_airport %}Landing: <img src="{{ url_for('static', filename='img/Transparent.gif') }}" class="flag flag-{{ entry.landing_airport.country_code|lower }}" alt="{{ entry.landing_airport.country_code }}"/> <a href="{{ url_for('logbook', country=entry.takeoff_airport.country_code, airport=entry.landing_airport.id, date=sel_date) }}">{{ entry.landing_airport.name }}</a>
{% endif %}
</td>
</tr>