diff --git a/ogn_python/model/airport.py b/ogn_python/model/airport.py index 7f9504c..866fd61 100644 --- a/ogn_python/model/airport.py +++ b/ogn_python/model/airport.py @@ -29,8 +29,8 @@ class Airport(db.Model): self.country_code, self.style, self.description, - self.location_wkt.latitude if self.location_wkt else None, - self.location_wkt.longitude if self.location_wkt else None, + self.location_wkt.latitude, + self.location_wkt.longitude, self.altitude, self.runway_direction, self.runway_length, diff --git a/ogn_python/routes.py b/ogn_python/routes.py index d37650b..cb01971 100644 --- a/ogn_python/routes.py +++ b/ogn_python/routes.py @@ -156,12 +156,12 @@ def logbook(): # Get Logbook filters = [] - if sel_date: - filters.append(db.func.date(Logbook.reftime) == sel_date) - if sel_country and sel_airport: filters.append(db.or_(Logbook.takeoff_airport_id == sel_airport, Logbook.landing_airport_id == sel_airport)) + if sel_date: + filters.append(db.func.date(Logbook.reftime) == sel_date) + if sel_device_id: filters.append(Logbook.device_id == sel_device_id) diff --git a/ogn_python/templates/logbook.html b/ogn_python/templates/logbook.html index 58a6787..c4e3ea9 100644 --- a/ogn_python/templates/logbook.html +++ b/ogn_python/templates/logbook.html @@ -40,17 +40,23 @@ Takeoff Landing AGL + Remark {% for entry in logbook %} {{ loop.index }} {% if entry.device.info is none %}{{ entry.device.address }}{% else %}{{ entry.device.info.registration }}{% endif %} - {% if entry.device.info is none %}(unknown){% else %}{{ entry.device.info.aircraft }}{% endif %} - {% if entry.takeoff_timestamp is not none %} {{ entry.takeoff_timestamp.strftime('%H:%M') }} {% endif %} - {% if entry.takeoff_track is not none %} {{ '%02d' | format(entry.takeoff_track/10) }} {% endif %} - {% if entry.landing_timestamp is not none %} {{ entry.landing_timestamp.strftime('%H:%M') }} {% endif %} - {% if entry.landing_track is not none %} {{ '%02d' | format(entry.landing_track/10) }} {% endif %} - {% if entry.max_altitude is not none %} {{ entry.max_altitude }} {% endif %} + {% if entry.device.info is none %}(?){% else %}{{ entry.device.info.aircraft }}{% endif %} + {% if entry.takeoff_timestamp is not none and entry.takeoff_airport.id|string() == sel_airport %} {{ entry.takeoff_timestamp.strftime('%H:%M') }} {% endif %} + {% if entry.takeoff_track is not none and entry.takeoff_airport.id|string() == sel_airport %} {{ '%02d' | format(entry.takeoff_track/10) }} {% endif %} + {% if entry.landing_timestamp is not none and entry.landing_airport.id|string() == sel_airport %} {{ entry.landing_timestamp.strftime('%H:%M') }} {% endif %} + {% if entry.landing_track is not none and entry.landing_airport.id|string() == sel_airport %} {{ '%02d' | format(entry.landing_track/10) }} {% endif %} + {% if entry.max_altitude is not none %}{{ entry.max_altitude - entry.takeoff_airport.altitude }} m{% endif %} + + {% if entry.takeoff_airport is not none and entry.takeoff_airport.id|string() != sel_airport %}Take Off: {{ entry.takeoff_airport.name }} + {% elif entry.landing_airport is not none and entry.landing_airport.id|string() != sel_airport %}Landing: {{ entry.landing_airport.name }} + {% endif %} + {% endfor %}