Don't return departures with negative countdown
Build image / build-image (push) Successful in 3m23s

This commit is contained in:
2025-04-24 20:12:27 +02:00
parent cf7bb96517
commit 16f7d80677
2 changed files with 7 additions and 5 deletions
+6 -4
View File
@@ -117,6 +117,12 @@ func ParseDepartures(response DMResponse, allowedPlatform *string) (Departures,
return Departures{}, errors.New("could not parse countdown")
}
matchesPlatform := allowedPlatform == nil || d.Platform == *allowedPlatform
isInThePast := countdown < 0
if !matchesPlatform || isInThePast {
continue
}
if countdown == 0 {
leaving = "sofort"
}
@@ -128,10 +134,6 @@ func ParseDepartures(response DMResponse, allowedPlatform *string) (Departures,
leaving = fmt.Sprintf("%02s:%02s", dt.Hour, dt.Minute)
}
if allowedPlatform != nil && d.Platform != *allowedPlatform {
continue
}
ds = append(ds, Departure{
d.Platform,
d.ServingLine.Symbol,