From fb960c660357f9cd4dca57be1325e4ecbb50f649 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Tue, 29 Nov 2022 16:38:21 +0100 Subject: controlroom: show tripShortName instead of tripId since the ids really should be internal to the gtfs, and not needed in "normal" contexts. --- lib/GTFS.hs | 5 +++++ lib/Server/ControlRoom.hs | 23 +++++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/GTFS.hs b/lib/GTFS.hs index 1fda897..8ff87db 100644 --- a/lib/GTFS.hs +++ b/lib/GTFS.hs @@ -639,3 +639,8 @@ runsToday :: MonadIO m => GTFS -> TripID -> m Bool runsToday gtfs trip = do today <- liftIO getCurrentTime <&> utctDay pure (runsOnDay gtfs trip today) + +tripName :: Trip a b -> Text +tripName Trip{..} = case tripShortName of + Just name -> name + Nothing -> tripTripID diff --git a/lib/Server/ControlRoom.hs b/lib/Server/ControlRoom.hs index b1948f2..f291d82 100644 --- a/lib/Server/ControlRoom.hs +++ b/lib/Server/ControlRoom.hs @@ -162,8 +162,8 @@ getTrainsR = do [whamlet|
_{MsgLastPing}: @@ -246,8 +246,8 @@ getTripsViewR = do [whamlet|
_{MsgtripId}: #{tripTripID} +
_{MsgtripHeadsign}: #{mightbe tripHeadsign} +
_{MsgtripShortname}: #{mightbe tripShortName}
Stops
@@ -339,7 +344,9 @@ announceForm day tripId = renderDivs $ Announcement
<*> aopt urlField (fieldSettingsLabel MsgMaybeWeblink) Nothing
<*> lift (liftIO getCurrentTime <&> Just)
-
+mightbe :: Maybe Text -> Text
+mightbe (Just a) = a
+mightbe Nothing = ""
--- some orphans to make hamlet easier to deal with
instance ToMarkup Time where
--
cgit v1.2.3