🔀 Merge pull request #1940 from rnowotniak/FIX/1939_Flights-widget-issues

Fix Flights.vue widget to work with the current aerodatabox API
This commit is contained in:
Alicia Sykes 2025-10-18 22:31:52 +01:00 committed by GitHub
commit 8fea366703
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,7 +5,7 @@
Live {{ direction !== 'both' ? direction: 'flight' }} data from {{ airport }}
</p>
<!-- Departures -->
<div v-if="departures.length > 0" class="flight-group">
<div v-if="direction !== 'arrival' && departures.length > 0" class="flight-group">
<h3 class="flight-type-subtitle" v-if="direction === 'both'">
{{ $t('widgets.flight-data.departures') }}
</h3>
@ -16,7 +16,7 @@
</div>
</div>
<!-- Arrivals -->
<div v-if="arrivals.length > 0" class="flight-group">
<div v-if="direction !== 'departure' && arrivals.length > 0" class="flight-group">
<h3 class="flight-type-subtitle" v-if="direction === 'both'">
{{ $t('widgets.flight-data.arrivals') }}
</h3>
@ -137,10 +137,12 @@ export default {
flights.forEach((flight) => {
results.push({
number: flight.number,
airline: flight.airline.name,
aircraft: flight.aircraft.model,
airport: flight.movement.airport.name,
time: flight.movement.actualTimeUtc,
airline: flight.airline?.name ?? "unknown airline",
aircraft: flight.aircraft?.model ?? "unknown aircraft",
airport: flight.movement?.airport?.name ?? "unknown airport",
time: flight.movement
? (flight.movement?.revisedTime?.local ?? flight.movement?.scheduledTime?.local ?? "unknown time")
: "unknown time"
});
});
return results;