Skip to content

Commit

Permalink
fix: use simpler logic to match the real world
Browse files Browse the repository at this point in the history
This hurts.
  • Loading branch information
davwheat committed Jan 16, 2024
1 parent 8f0be1f commit f22cae8
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/announcement-data/systems/stations/AmeyPhil.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4070,15 +4070,23 @@ export default class AmeyPhil extends StationAnnouncementSystem {

const aPortionStops = new Set([...splitData.splitA!!.stops.map(s => s.crsCode)])
const bPortionStops = new Set([...splitData.splitB!!.stops.map(s => s.crsCode)])

// Note to future me:
//
// The commented logic below handled common calling points in both portions of the train.
// However, this is not needed as the logic on the real-world system didn't account for this.
//
// F.

const anyPortionStops = new Set([
...splitData.stopsUpToSplit.map(s => s.crsCode),
...Array.from(aPortionStops).filter(x => bPortionStops.has(x)),
// ...Array.from(aPortionStops).filter(x => bPortionStops.has(x)),
])

Array.from(anyPortionStops).forEach(s => {
if (aPortionStops.has(s)) aPortionStops.delete(s)
if (bPortionStops.has(s)) bPortionStops.delete(s)
})
// Array.from(anyPortionStops).forEach(s => {
// if (aPortionStops.has(s)) aPortionStops.delete(s)
// if (bPortionStops.has(s)) bPortionStops.delete(s)
// })

const listStops = (stops: string[]): AudioItem[] => {
return [
Expand Down

0 comments on commit f22cae8

Please sign in to comment.