aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstuebinm2024-05-03 00:23:13 +0200
committerstuebinm2024-05-03 00:23:13 +0200
commit6b62d2676be49fb081e7f5aaf2c04889280f3a09 (patch)
treeb6616cce696420b7cd674cce992f8e77717fca2a
parent7c6285d66c597f8619a7a6c343b3c4bc66bfc4e8 (diff)
fix: tripupdates should not contain old trips
apparently i forgot an if here?
-rw-r--r--lib/Server/GTFS_RT.hs4
1 files changed, 2 insertions, 2 deletions
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 .~