From fcc595591eaabba66f43415c0fcf5470f4ba5c70 Mon Sep 17 00:00:00 2001 From: David Wheatley Date: Wed, 23 Oct 2024 00:38:43 +0100 Subject: [PATCH] fix: missing if around alert --- .../systems/stations/AmeyPhil.tsx | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/announcement-data/systems/stations/AmeyPhil.tsx b/src/announcement-data/systems/stations/AmeyPhil.tsx index b2a5fb196..5658e2e50 100644 --- a/src/announcement-data/systems/stations/AmeyPhil.tsx +++ b/src/announcement-data/systems/stations/AmeyPhil.tsx @@ -6397,10 +6397,12 @@ export default class AmeyPhil extends StationAnnouncementSystem { [...destinationLocations.map(l => l.crs), ...callingPoints.map(l => l.crsCode)].filter(Boolean) as string[] ).filter(c => !this.STATIONS.includes(c)) const invalidStationNames = invalidStationCrses.map(c => `- ${crsToStationItemMapper(c).name}`) - alert( - "Some stations in this train's calling pattern are not available with this announcement system. The following locations have been removed:\n" + - invalidStationNames.join('\n'), - ) + if (invalidStationNames.length > 0) { + alert( + "Some stations in this train's calling pattern are not available with this announcement system. The following locations have been removed:\n" + + invalidStationNames.join('\n'), + ) + } const invalidDestinationCrses = destinationLocations.filter(d => !d.crs || !this.STATIONS.includes(d.crs)).map(d => d.crs!!) if (invalidDestinationCrses.length > 0) { @@ -6527,10 +6529,12 @@ export default class AmeyPhil extends StationAnnouncementSystem { const invalidStationCrses = (callingPoints.map(l => l.crsCode).filter(Boolean) as string[]).filter(c => !this.STATIONS.includes(c)) const invalidStationNames = invalidStationCrses.map(c => `- ${crsToStationItemMapper(c).name}`) - alert( - "Some stations in this train's calling pattern are not available with this announcement system. The following locations have been removed:\n" + - invalidStationNames.join('\n'), - ) + if (invalidStationNames.length > 0) { + alert( + "Some stations in this train's calling pattern are not available with this announcement system. The following locations have been removed:\n" + + invalidStationNames.join('\n'), + ) + } const invalidDestinationCrses = destinationLocations.filter(d => !d.crs || !this.STATIONS.includes(d.crs)).map(d => d.crs!!) if (invalidDestinationCrses.length > 0) {