Skip to content

Conversation

frothedoatmilk
Copy link
Contributor

Fix #224 and swap out our implementation of GTFS hooks for our gtfs-react-hooks package.

@frothedoatmilk frothedoatmilk requested a review from benmelz June 25, 2025 19:39
@frothedoatmilk
Copy link
Contributor Author

Apologies for the nasty diff in publicMessagesFromGtfs.js now...but these naming conventions are the fucking worst.

// them out. Alerts are prototyped, so blank route ids end up being empty strings. So we will end up filtering
// out agency wide alerts without that second conditional.
gtfsEntities = gtfsEntities.filter((gtfsEntity) => {
return gtfsEntity.alert.informedEntity.every((entity) => entity.routeId in routesGtfsMap) ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return gtfsEntity.alert.informedEntity.every((entity) => entity.routeId in routesGtfsMap) ||
return gtfsEntity.alert.informedEntity.some((entity) => entity.routeId in routesGtfsMap) ||

It just occurred to me - what if the long-running alert applies to one route that stays and one route that is removed from the schedule? We'd probably want to keep that alert at this stage?

I think this would have to be paired with another adjustment I'm gonna suggest below

alert: {
...gtfsAlert.alert,
...gtfsEntity.alert,
informedEntity: routeIds.map((routeId) => routesGtfsMap[routeId])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
informedEntity: routeIds.map((routeId) => routesGtfsMap[routeId])
informedEntity: routeIds.map((routeId) => routesGtfsMap[routeId]).filter((route) => route)

i.e. if we didn't get an actual route from the routeMap, discard it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch backend to swiftly
2 participants