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