Put different takeoff / landing airport to "remarks"

pull/78/head
Konstantin Gründger 2019-03-23 18:08:00 +01:00
rodzic 1909442241
commit f5701db672
3 zmienionych plików z 17 dodań i 11 usunięć

Wyświetl plik

@ -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,

Wyświetl plik

@ -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)

Wyświetl plik

@ -40,17 +40,23 @@
<th colspan="2">Takeoff</th>
<th colspan="2">Landing</th>
<th>AGL</th>
<th>Remark</th>
</tr>
{% for entry in logbook %}
<tr>
<td>{{ loop.index }}</td>
<td><a href="{{ url_for('device_detail', id=entry.device.id) }}">{% if entry.device.info is none %}{{ entry.device.address }}{% else %}{{ entry.device.info.registration }}{% endif %}</a></td>
<td>{% if entry.device.info is none %}(unknown){% else %}{{ entry.device.info.aircraft }}{% endif %}</td>
<td>{% if entry.takeoff_timestamp is not none %} {{ entry.takeoff_timestamp.strftime('%H:%M') }} {% endif %}</td>
<td>{% if entry.takeoff_track is not none %} {{ '%02d' | format(entry.takeoff_track/10) }} {% endif %}</td>
<td>{% if entry.landing_timestamp is not none %} {{ entry.landing_timestamp.strftime('%H:%M') }} {% endif %}</td>
<td>{% if entry.landing_track is not none %} {{ '%02d' | format(entry.landing_track/10) }} {% endif %}</td>
<td>{% if entry.max_altitude is not none %} {{ entry.max_altitude }} {% endif %}</td>
<td>{% if entry.device.info is none %}(?){% else %}{{ entry.device.info.aircraft }}{% endif %}</td>
<td>{% if entry.takeoff_timestamp is not none and entry.takeoff_airport.id|string() == sel_airport %} {{ entry.takeoff_timestamp.strftime('%H:%M') }} {% endif %}</td>
<td>{% if entry.takeoff_track is not none and entry.takeoff_airport.id|string() == sel_airport %} {{ '%02d' | format(entry.takeoff_track/10) }} {% endif %}</td>
<td>{% if entry.landing_timestamp is not none and entry.landing_airport.id|string() == sel_airport %} {{ entry.landing_timestamp.strftime('%H:%M') }} {% endif %}</td>
<td>{% if entry.landing_track is not none and entry.landing_airport.id|string() == sel_airport %} {{ '%02d' | format(entry.landing_track/10) }} {% endif %}</td>
<td>{% if entry.max_altitude is not none %}{{ entry.max_altitude - entry.takeoff_airport.altitude }} m{% endif %}</td>
<td>
{% if entry.takeoff_airport is not none and entry.takeoff_airport.id|string() != sel_airport %}Take Off: <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|string() != sel_airport %}Landing: <a href="{{ url_for('logbook', airport=entry.landing_airport.id) }}">{{ entry.landing_airport.name }}</a>
{% endif %}
</td>
</tr>
{% endfor %}
</table>