Skip to content

Commit

Permalink
fix: bad regex
Browse files Browse the repository at this point in the history
  • Loading branch information
davwheat committed Feb 16, 2024
1 parent da73461 commit b2749bf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/AmeyLiveTrainAnnouncements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export function LiveTrainAnnouncements<SystemKeys extends string>({
}

// Remove CRS from end of label
return [s.label.toLowerCase().replace(/ ([A-Z0-9]{3})$/i, ''), s.value]
return [s.label.toLowerCase().replace(/ \([A-Z0-9]{3}\)$/i, ''), s.value]
})
.filter(x => x) as [string, string][],
),
Expand Down Expand Up @@ -405,7 +405,7 @@ export function LiveTrainAnnouncements<SystemKeys extends string>({
const guessViaCrs = guessViaPoint(via.trim().toLowerCase(), train.subsequentLocations)

addLog(`Guessed via ${guessViaCrs} for ${via}`)
console.log(`[Live Trains] Guessed via ${guessViaCrs} for ${via}`)
console.log(`[Live Trains] Guessed via ${guessViaCrs} for ${via.trim()}`)

if (guessViaCrs && systems[systemKey].STATIONS.includes(guessViaCrs)) {
const point = train.subsequentLocations.find(p => p.crs === guessViaCrs)
Expand Down Expand Up @@ -496,7 +496,7 @@ export function LiveTrainAnnouncements<SystemKeys extends string>({
const guessViaCrs = guessViaPoint(via.trim().toLowerCase(), train.subsequentLocations)

addLog(`Guessed via ${guessViaCrs} for ${via}`)
console.log(`[Live Trains] Guessed via ${guessViaCrs} for ${via}`)
console.log(`[Live Trains] Guessed via ${guessViaCrs} for ${via.trim()}`)

if (guessViaCrs && systems[systemKey].STATIONS.includes(guessViaCrs)) {
const point = train.subsequentLocations.find(p => p.crs === guessViaCrs)
Expand Down Expand Up @@ -631,7 +631,7 @@ export function LiveTrainAnnouncements<SystemKeys extends string>({
const guessViaCrs = guessViaPoint(via.trim().toLowerCase(), train.subsequentLocations)

addLog(`Guessed via ${guessViaCrs} for ${via}`)
console.log(`[Live Trains] Guessed via ${guessViaCrs} for ${via}`)
console.log(`[Live Trains] Guessed via ${guessViaCrs} for ${via.trim()}`)

if (guessViaCrs && systems[systemKey].STATIONS.includes(guessViaCrs)) {
const point = train.subsequentLocations.find(p => p.crs === guessViaCrs)
Expand Down

0 comments on commit b2749bf

Please sign in to comment.