From fdbc4d69b9e41ecf283428a9fb0f1fad015c5187 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Sat, 3 Dec 2022 11:55:09 +0100 Subject: this is almost certainly bullshit --- lib/Server/GTFS_RT.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Server/GTFS_RT.hs b/lib/Server/GTFS_RT.hs index f43690c..f317f7c 100644 --- a/lib/Server/GTFS_RT.hs +++ b/lib/Server/GTFS_RT.hs @@ -127,7 +127,7 @@ gtfsRealtimeServer gtfs@GTFS{..} dbpool = handleServiceAlerts :<|> handleTripUpd , informed_entity = [dEntitySelector { ES.trip = - Just (dTripDescriptor announcementTrip (Just announcementDay)) + Just (dTripDescriptor announcementTrip (Just announcementDay) Nothing) } ] , cause = Nothing @@ -164,7 +164,7 @@ gtfsRealtimeServer gtfs@GTFS{..} dbpool = handleServiceAlerts :<|> handleTripUpd -- note: these IDs should be stable across iterations, so just do tripId + runningday. TODO: breaks in case of cross-midnight? in (dFeedEntity (Utf8 $ fromStrict $ (encodeUtf8 tripId <> "-" <> (C8.pack $ iso8601Show today)))) { FE.trip_update = Just $ TripUpdate - { TU.trip = dTripDescriptor tripId (Just today) -- TODO will break if cross-midnight train + { TU.trip = dTripDescriptor tripId (Just today) (Just $ toUtf8 $ T.pack $ show $ stopDeparture $ V.head tripStops) -- TODO will break if cross-midnight train , TU.vehicle = Nothing , TU.stop_time_update = Seq.fromList $ fmap (\(TrainAnchor{..}, Stop{..}) -> StopTimeUpdate @@ -195,7 +195,7 @@ gtfsRealtimeServer gtfs@GTFS{..} dbpool = handleServiceAlerts :<|> handleTripUpd where mkPosition (Entity (TrainPingKey key) TrainPing{..}, Running{..}) = (dFeedEntity (toUtf8 . T.pack . show $ key)) { FE.vehicle = Just $ VehiclePosition - { trip = Just (dTripDescriptor runningTrip Nothing) + { trip = Just (dTripDescriptor runningTrip Nothing Nothing) , VP.vehicle = case runningVehicle of Nothing -> Nothing Just trainset -> Just $ VehicleDescriptor @@ -264,12 +264,12 @@ dEntitySelector = EntitySelector , ES.ext'field = defaultValue } -dTripDescriptor :: TripID -> Maybe Day -> TripDescriptor -dTripDescriptor tripID day = TripDescriptor +dTripDescriptor :: TripID -> Maybe Day -> Maybe Utf8 -> TripDescriptor +dTripDescriptor tripID day starttime = TripDescriptor { trip_id = Just (toUtf8 tripID) , route_id = Nothing , direction_id = Nothing - , start_time = Nothing + , start_time = starttime , start_date = fmap toStupidDate day , schedule_relationship = Nothing , TD.ext'field = defaultValue -- cgit v1.2.3