fix: populate situations in vehicles-for-agency references#819
Open
reddy-santhu wants to merge 1 commit intoOneBusAway:mainfrom
Open
fix: populate situations in vehicles-for-agency references#819reddy-santhu wants to merge 1 commit intoOneBusAway:mainfrom
reddy-santhu wants to merge 1 commit intoOneBusAway:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #818
fixes the
vehicles-for-agencyendpoint always returning an emptyreferences.situationsarray. Checked the Java OBA server (MTA NYCTproduction) and it does return situations in the references block for this
endpoint.
The handler was simply never wired up to collect alerts. Every other endpoint
that returns a
referencesblock already does this.Changes
internal/restapi/vehicles_for_agency_handler.goAfter building the vehicle list, collect route-level and agency-wide alerts
and populate
references.situations. Route IDs are already gathered beforethe loop for the existing batch route fetch, so nothing new hits the DB.
internal/gtfs/gtfs_manager_mock.goMockResetRealTimeDatawasn't clearingfeedAlerts, so any test thatinjected an alert into the shared manager would leak it into later tests.
Added the missing reset and a
rebuildMergedRealtimeLockedcall.Testing
Added two tests:
references.situationsreferences.situationsTrip-scoped alerts are intentionally not collected here doing so would
require a DB query per vehicle which doesn't scale over a full fleet. Route
and agency scoping covers what real feeds publish in practice, and matches
how other endpoints handle the same trade-off.