diff options
author | stuebinm | 2022-12-03 11:55:09 +0100 |
---|---|---|
committer | stuebinm | 2022-12-03 11:55:09 +0100 |
commit | fdbc4d69b9e41ecf283428a9fb0f1fad015c5187 (patch) | |
tree | aa8e91ddfc65f9859aacfd821afd7ca77f85bf90 | |
parent | cfe3d47ccb4bd08ecbc2f369785c00b06dc932d8 (diff) |
this is almost certainly bullshit
-rw-r--r-- | lib/Server/GTFS_RT.hs | 12 |
1 files 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 |