Skip to content

Commit

Permalink
fix: missing if around alert
Browse files Browse the repository at this point in the history
  • Loading branch information
davwheat committed Oct 22, 2024
1 parent 8c4a491 commit fcc5955
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/announcement-data/systems/stations/AmeyPhil.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit fcc5955

Please sign in to comment.