Don't return departures with negative countdown
Build image / build-image (push) Successful in 3m23s
Build image / build-image (push) Successful in 3m23s
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user