chore(lms): minor changes

This commit is contained in:
Steffen Jost 2022-03-10 19:47:45 +01:00
parent eeb22dec97
commit f9fb236025
2 changed files with 5 additions and 1 deletions

View File

@ -1066,6 +1066,8 @@ dbTable PSValidator{..} dbtable@DBTable{ dbtIdent = dbtIdent'@(toPathPiece -> db
<|> piInput
psShortcircuit <- (== Just dbtIdent') <$> lookupCustomHeader HeaderDBTableShortcircuit
lch <- lookupCustomHeader HeaderDBTableShortcircuit
$logErrorS "DBShortcircuit" $ fromMaybe mempty lch <> " and also " <> tshow psShortcircuit
let
-- adjustPI = over _piSorting $ guardOnM doSorting -- probably not neccessary; not displaying the links should be enough for now

View File

@ -12,6 +12,7 @@ import Database.Persist.Sql
import qualified Database.Esqueleto.Legacy as E
import qualified Data.Csv as Csv
import qualified Data.Time.Format as Time
import Data.Time.Format.ISO8601 (iso8601ParseM)
import Utils.Lens.TH
newtype LmsIdent = LmsIdent { getLmsIdent :: Text }
@ -54,7 +55,7 @@ instance Csv.FromField LmsBool where
parseField i
| i == "0" = pure $ LmsBool False
| i == "1" = pure $ LmsBool True
| otherwise = empty
| otherwise = mempty
-- | LMS interface requires day format not compliant with iso8601
newtype LmsDay = LmsDay { lms2day :: Day }
@ -76,4 +77,5 @@ instance Csv.FromField LmsDay where
parseField i = do
s <- Csv.parseField i
d <- Time.parseTimeM True Time.defaultTimeLocale lmsDayFormat s
<|> iso8601ParseM s -- Know-How AG considers supplying iso8601 dates in the future
return $ LmsDay d