From 091e7853ebffdfa924c70a181cb379c73fdc3654 Mon Sep 17 00:00:00 2001 From: Keith Paterson Date: Tue, 1 Jun 2021 14:44:43 +0200 Subject: [PATCH] #138 --- src/renderer/components/AirlineItem.vue | 16 ++++++++++------ src/renderer/loaders/traffic_loader.js | 1 + 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/renderer/components/AirlineItem.vue b/src/renderer/components/AirlineItem.vue index 3bc4f35..8038296 100644 --- a/src/renderer/components/AirlineItem.vue +++ b/src/renderer/components/AirlineItem.vue @@ -12,9 +12,8 @@ You should have received a copy of the GNU General Public License along with FG @@ -68,12 +67,17 @@ export default { }, traffic: function () { if (this.filename) { - return this.trafficFile.filter(f => f.callsign).filter(f => + var aircraftLookup = this.trafficFile.filter(a => a['required-aircraft']) + .reduce((req, acc) => { + req[acc['required-aircraft']] = acc + return req + }, {}) + var ret = this.trafficFile.filter(f => f.callsign).filter(f => (f.departure.port === this.$store.state.Airports.currentAirport.icao && this.direction === 0) || (f.arrival.port === this.$store.state.Airports.currentAirport.icao && this.direction === 1) - ) + ).map(obj => ({ ...obj, flighttype: aircraftLookup[obj['required-aircraft']].flighttype })) + return ret } - console.debug(this.filename) }, aircraft: function () { if (this.filename) { diff --git a/src/renderer/loaders/traffic_loader.js b/src/renderer/loaders/traffic_loader.js index 05d7814..4818896 100644 --- a/src/renderer/loaders/traffic_loader.js +++ b/src/renderer/loaders/traffic_loader.js @@ -68,6 +68,7 @@ function flightMapper(params) { return { id: `${btoa(buildId(params))}`, callsign: params.find('callsign').text(), + 'required-aircraft': params.find('required-aircraft').text(), arrival: { port: params.find('arrival/port').text(), time: params.find('arrival/time').text()