From f9d0469466bb2b098daa1d786ee76cb0cf77c9c6 Mon Sep 17 00:00:00 2001 From: Keith Paterson Date: Thu, 3 Jun 2021 15:03:22 +0200 Subject: [PATCH] Unique Trafficlist --- src/renderer/components/AirlineItem.vue | 13 +++++++------ src/renderer/components/TrafficList.vue | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/renderer/components/AirlineItem.vue b/src/renderer/components/AirlineItem.vue index 8038296..507cf06 100644 --- a/src/renderer/components/AirlineItem.vue +++ b/src/renderer/components/AirlineItem.vue @@ -10,10 +10,10 @@ FG Airports is distributed in the hope that it will be useful, but WITHOUT ANY W You should have received a copy of the GNU General Public License along with FG Airports. If not, see http://www.gnu.org/licenses/. --> @@ -74,8 +74,9 @@ export default { }, {}) 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 })) + (f.arrival.port === this.$store.state.Airports.currentAirport.icao && this.direction === 1)) + .map(obj => ({ ...obj, flighttype: aircraftLookup[obj['required-aircraft']].flighttype })) + .filter((v, i, a) => a.findIndex(t => (t.id === v.id)) === i) return ret } }, diff --git a/src/renderer/components/TrafficList.vue b/src/renderer/components/TrafficList.vue index 08c6103..362086d 100644 --- a/src/renderer/components/TrafficList.vue +++ b/src/renderer/components/TrafficList.vue @@ -81,7 +81,7 @@ You should have received a copy of the GNU General Public License along with FG airlineCodes.push({value: element, label: element}) }) } - return airlineCodes + return airlineCodes.filter((v, i, a) => a.indexOf(v) === i) } } }