some custom stuff

This commit is contained in:
2025-11-15 00:23:48 +01:00
parent 4dbbd30d4d
commit c189e3f59a
19 changed files with 1116 additions and 831 deletions

View File

@@ -8,9 +8,9 @@ import (
type Trip struct {
*Route
Stops []*StopTime `json:"stops" csv:"stops"`
RouteID string `json:"route_id" csv:"route_id"`
ServiceID string `json:"service_id" csv:"service_id"`
TripID string `json:"trip_id" csv:"trip_id"`
RouteId string `json:"route_id" csv:"route_id"`
ServiceId string `json:"service_id" csv:"service_id"`
TripId string `json:"trip_id" csv:"trip_id"`
TripHeadsign string `json:"trip_headsign" csv:"trip_headsign"`
TripShortName string `json:"trip_short_name" csv:"trip_short_name"`
}
@@ -20,7 +20,7 @@ func (t *Trip) GetDirectPossibleDestinations(stop *Stop, when time.Time) iter.Se
started := false
for _, st := range t.Stops {
if !started {
if st.StopID == stop.StopID && st.PickupType == 0 {
if st.StopId == stop.StopId && st.PickupType == 0 {
started = true
}
continue
@@ -44,3 +44,12 @@ func (t *Trip) AddStopTime(stopTime *StopTime) {
}
t.Stops = append(t.Stops, stopTime)
}
func (t *Trip) Has(stop *Stop) (*StopTime, bool) {
for _, st := range t.Stops {
if st.StopId == stop.StopId {
return st, true
}
}
return nil, false
}