Skip to content

Commit

Permalink
fix: refactor to exclude terminating station from callingAt list
Browse files Browse the repository at this point in the history
  • Loading branch information
davwheat committed Nov 3, 2023
1 parent ac65678 commit 318d30c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/announcement-data/systems/stations/KeTechPhil.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3805,10 +3805,13 @@ function LiveTrainAnnouncements({ nextTrainHandler, system }: LiveTrainAnnouncem
terminatingStationCode: firstUnannounced.destination[0].crs,
vias: [],
callingAt: firstUnannounced.subsequentCallingPoints[0].callingPoint
.map((p): CallingAtPoint | null => {
.map((p, i): CallingAtPoint | null => {
if (p.isCancelled || p.et === 'Cancelled') return null
if (!system.stations.includes(p.crs)) return null

if (i === firstUnannounced.subsequentCallingPoints[0].callingPoint.length - 1 && p.crs === firstUnannounced.destination[0].crs)
return null

return {
crsCode: p.crs,
name: '',
Expand Down

0 comments on commit 318d30c

Please sign in to comment.