Don't request complete stop sequence

This commit is contained in:
Paul Brinkmeier 2025-04-23 12:01:34 +02:00
parent 00abbcbb90
commit 723372238b
2 changed files with 6 additions and 2 deletions

View File

@ -16,7 +16,7 @@
vrnp-static = pkgs.buildGoModule {
pname = "vrnp";
version = "0.0.3";
version = "0.0.4";
vendorHash = null;
# For building the package, we use only the files not ignored by Git as inputs.

View File

@ -54,7 +54,7 @@ func FetchDepartures(stopId string) (DMResponse, error) {
query := url.Values{}
query.Set("coordOutputFormat", "EPSG:4326")
query.Set("depType", "stopEvents")
query.Set("includeCompleteStopSeq", "1")
query.Set("includeCompleteStopSeq", "0")
query.Set("limit", "10")
query.Set("locationServerActive", "0")
query.Set("mode", "direct")
@ -91,6 +91,7 @@ type Departures struct {
}
type Departure struct {
Platform string `json:"platform"`
Symbol string `json:"symbol"`
Direction string `json:"direction"`
Leaving string `json:"leaving"`
@ -101,6 +102,8 @@ func ParseDepartures(response DMResponse, allowedPlatform *string) (Departures,
for _, d := range response.DepartureList {
direction := d.ServingLine.Direction
// If available, use name of last stop as direction
// Note that OnwardStopSeq is only populated if includeCompleteStopSeq=1 is set.
if len(d.OnwardStopSeq) != 0 {
last := d.OnwardStopSeq[len(d.OnwardStopSeq)-1]
if slices.Contains([]string{"5", "6"}, last.PlaceID) {
@ -130,6 +133,7 @@ func ParseDepartures(response DMResponse, allowedPlatform *string) (Departures,
}
ds = append(ds, Departure{
d.Platform,
d.ServingLine.Symbol,
direction,
leaving,