Skip to content

Commit 8fea366

Browse files
authored
🔀 Merge pull request #1940 from rnowotniak/FIX/1939_Flights-widget-issues
Fix Flights.vue widget to work with the current aerodatabox API
2 parents e219704 + 7d44e8e commit 8fea366

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

‎src/components/Widgets/Flights.vue‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Live {{ direction !== 'both' ? direction: 'flight' }} data from {{ airport }}
66
</p>
77
<!-- Departures -->
8-
<div v-if="departures.length > 0" class="flight-group">
8+
<div v-if="direction !== 'arrival' && departures.length > 0" class="flight-group">
99
<h3 class="flight-type-subtitle" v-if="direction === 'both'">
1010
{{ $t('widgets.flight-data.departures') }}
1111
</h3>
@@ -16,7 +16,7 @@
1616
</div>
1717
</div>
1818
<!-- Arrivals -->
19-
<div v-if="arrivals.length > 0" class="flight-group">
19+
<div v-if="direction !== 'departure' && arrivals.length > 0" class="flight-group">
2020
<h3 class="flight-type-subtitle" v-if="direction === 'both'">
2121
{{ $t('widgets.flight-data.arrivals') }}
2222
</h3>
@@ -137,10 +137,12 @@ export default {
137137
flights.forEach((flight) => {
138138
results.push({
139139
number: flight.number,
140-
airline: flight.airline.name,
141-
aircraft: flight.aircraft.model,
142-
airport: flight.movement.airport.name,
143-
time: flight.movement.actualTimeUtc,
140+
airline: flight.airline?.name ?? "unknown airline",
141+
aircraft: flight.aircraft?.model ?? "unknown aircraft",
142+
airport: flight.movement?.airport?.name ?? "unknown airport",
143+
time: flight.movement
144+
? (flight.movement?.revisedTime?.local ?? flight.movement?.scheduledTime?.local ?? "unknown time")
145+
: "unknown time"
144146
});
145147
});
146148
return results;

0 commit comments

Comments
 (0)