From 5f50d33cdf8c5e3a64755ef8819cc3b9d027837e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Gru=CC=88ndger?= Date: Wed, 3 Apr 2019 20:59:25 +0200 Subject: [PATCH] Use cached airport list --- ogn_python/routes.py | 4 +--- ogn_python/templates/airports.html | 4 ++-- ogn_python/templates/logbook.html | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/ogn_python/routes.py b/ogn_python/routes.py index 28f46f7..54dd5d1 100644 --- a/ogn_python/routes.py +++ b/ogn_python/routes.py @@ -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 = [] diff --git a/ogn_python/templates/airports.html b/ogn_python/templates/airports.html index 34ac124..a2c1b34 100644 --- a/ogn_python/templates/airports.html +++ b/ogn_python/templates/airports.html @@ -30,8 +30,8 @@ {% for airport in airports %} {{ loop.index }} - {{ airport.country_code }} {{ airport.name }} - Logbook + {{ sel_country }} {{ airport.name }} + Logbook {% endfor %} diff --git a/ogn_python/templates/logbook.html b/ogn_python/templates/logbook.html index f677ae4..fb4bb52 100644 --- a/ogn_python/templates/logbook.html +++ b/ogn_python/templates/logbook.html @@ -61,8 +61,8 @@ {% if entry.duration is not none %}{{ entry.duration }}{% endif %} {% if entry.max_altitude is not none %}{{ '%0.1f'|format(entry.max_altitude - entry.takeoff_airport.altitude) }} m{% endif %} - {% if entry.takeoff_airport is not none and entry.takeoff_airport.id != sel_airport %}Take Off: {{ entry.takeoff_airport.country_code }} {{ entry.takeoff_airport.name }} - {% elif entry.landing_airport is not none and entry.landing_airport.id != sel_airport %}Landing: {{ entry.landing_airport.country_code }} {{ entry.landing_airport.name }} + {% if entry.takeoff_airport is not none and entry.takeoff_airport.id != sel_airport %}Take Off: {{ entry.takeoff_airport.country_code }} {{ entry.takeoff_airport.name }} + {% elif entry.landing_airport is not none and entry.landing_airport.id != sel_airport %}Landing: {{ entry.landing_airport.country_code }} {{ entry.landing_airport.name }} {% endif %}