Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1235,12 +1235,11 @@ func TestArrivalsAndDeparturesForStop_VehicleWithNilID(t *testing.T) {
api := createTestApiWithClock(t, mockClock)
defer api.Shutdown()
t.Cleanup(api.GtfsManager.MockResetRealTimeData)
// Clear the service-IDs cache so that the calendar inserted below is visible,
// even if a previous test already cached the result for this date.
api.GtfsManager.MockClearServiceIDsCache()
// Ensure cache is cleared before test runs
api.GtfsManager.MockClearServiceIDsCache()

// Clear the service-IDs cache so the request sees the newly inserted calendar entry
api.GtfsManager.MockClearServiceIDsCache()
// Also clean up after test
t.Cleanup(api.GtfsManager.MockClearServiceIDsCache)

ctx := context.Background()
queries := api.GtfsManager.GtfsDB.Queries
Expand Down Expand Up @@ -1289,6 +1288,10 @@ func TestArrivalsAndDeparturesForStop_VehicleWithNilID(t *testing.T) {
})
require.NoError(t, err)

// Clear the service-IDs cache so the upcoming request sees the newly inserted
// calendar entry rather than a result cached by an earlier test in this package.
api.GtfsManager.MockClearServiceIDsCache()

_, err = queries.CreateTrip(ctx, gtfsdb.CreateTripParams{
ID: tripID,
RouteID: routeID,
Expand Down
2 changes: 1 addition & 1 deletion internal/restapi/block_sequence_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func (api *RestAPI) getBlockSequenceForStopSequence(ctx context.Context, tripID

blockTrips, err := api.GtfsManager.GtfsDB.Queries.GetTripsByBlockID(ctx, blockID)
if err != nil {
return 0
return stopSequence
}

type TripWithDetails struct {
Expand Down
4 changes: 2 additions & 2 deletions internal/restapi/schedule_for_route_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ func (api *RestAPI) scheduleForRouteHandler(w http.ResponseWriter, r *http.Reque
combinedTripID := utils.FormCombinedID(agencyID, t.ID)
tripRef := models.NewTripReference(
combinedTripID,
t.RouteID,
t.ServiceID,
utils.FormCombinedID(agencyID, t.RouteID),
utils.FormCombinedID(agencyID, t.ServiceID),
t.TripHeadsign.String,
t.TripShortName.String,
strconv.FormatInt(t.DirectionID.Int64, 10),
Expand Down
Loading