From 6b62d2676be49fb081e7f5aaf2c04889280f3a09 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Fri, 3 May 2024 00:23:13 +0200 Subject: fix: tripupdates should not contain old trips apparently i forgot an if here? --- lib/Server/GTFS_RT.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/Server') diff --git a/lib/Server/GTFS_RT.hs b/lib/Server/GTFS_RT.hs index d2e53a1..236f4cc 100644 --- a/lib/Server/GTFS_RT.hs +++ b/lib/Server/GTFS_RT.hs @@ -99,7 +99,7 @@ gtfsRealtimeServer gtfs@GTFS{..} dbpool = today <- liftIO $ getCurrentTime <&> utctDay nowSeconds <- secondsNow today -- let running = M.toList (tripsOnDay gtfs today) - tickets <- selectList [TicketCompleted ==. False] [Asc TicketTripName] + tickets <- selectList [TicketCompleted ==. False, TicketDay ==. today] [Asc TicketTripName] tripUpdates <- forM tickets $ \(Entity key Ticket{..}) -> do selectList [TrainAnchorTicket ==. key] [] >>= \a -> case nonEmpty a of @@ -117,7 +117,7 @@ gtfsRealtimeServer gtfs@GTFS{..} dbpool = let stillRunning = trainAnchorDelay lastAnchor + toSeconds (stopArrival lastStop) tzseries today < nowSeconds + 5 * 60 - pure $ Just $ defMessage + pure $ if not stillRunning then Nothing else Just $ defMessage & RT.id .~ UUID.toText (coerce key) & RT.tripUpdate .~ (defMessage & RT.trip .~ -- cgit v1.2.3