diff --git a/flake.nix b/flake.nix index 7f132a2..b22cd43 100644 --- a/flake.nix +++ b/flake.nix @@ -16,7 +16,7 @@ vrnp-static = pkgs.buildGoModule { pname = "vrnp"; - version = "0.0.4"; + version = "0.0.5"; vendorHash = null; # For building the package, we use only the files not ignored by Git as inputs. diff --git a/main.go b/main.go index 6c1ba74..24e6c8d 100644 --- a/main.go +++ b/main.go @@ -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,