From df1a816d839b119de5aebe2912aad061e8a5c72c Mon Sep 17 00:00:00 2001 From: Steffen Jost Date: Wed, 14 Dec 2022 16:05:03 +0100 Subject: [PATCH] chore(avs): minor improve avs debugging printout --- src/Handler/Admin/Avs.hs | 87 ++++++++++++++++++++++------------------ templates/avs.hamlet | 4 +- 2 files changed, 49 insertions(+), 42 deletions(-) diff --git a/src/Handler/Admin/Avs.hs b/src/Handler/Admin/Avs.hs index bf537f77c..6e6c51985 100644 --- a/src/Handler/Admin/Avs.hs +++ b/src/Handler/Admin/Avs.hs @@ -6,7 +6,7 @@ module Handler.Admin.Avs ( getAdminAvsR, postAdminAvsR - , getProblemAvsSynchR, postProblemAvsSynchR + , getProblemAvsSynchR, postProblemAvsSynchR ) where import Import @@ -23,7 +23,7 @@ import Utils.Avs import Database.Esqueleto.Experimental ((:&)(..)) import qualified Database.Esqueleto.Legacy as E -import qualified Database.Esqueleto.Experimental as E hiding (from, on) +import qualified Database.Esqueleto.Experimental as E hiding (from, on) import qualified Database.Esqueleto.Experimental as X (from, on) -- needs TypeApplications Lang-Pragma import qualified Database.Esqueleto.Utils as E @@ -39,7 +39,7 @@ nullaryPathPiece ''ButtonAvsTest camelToPathPiece instance Button UniWorX ButtonAvsTest where btnLabel BtnCheckLicences = "Check all licences" -- could be msg btnLabel BtnSynchLicences = "Synchronize all licences" -- could be msg - btnClasses BtnCheckLicences = [BCIsButton, BCPrimary] + btnClasses BtnCheckLicences = [BCIsButton, BCPrimary] btnClasses BtnSynchLicences = [BCIsButton, BCDanger] -- END Button @@ -57,9 +57,9 @@ makeAvsPersonForm tmpl = identifyForm FIDAvsQueryPerson . validateForm validateA <*> aopt textField (fslI MsgAvsVersionNo) (avsPersonQueryVersionNo <$> tmpl) <*> aopt textField (fslI MsgAvsFirstName) (avsPersonQueryFirstName <$> tmpl) <*> aopt textField (fslI MsgAvsLastName) (avsPersonQueryLastName <$> tmpl) - <*> aopt avsInternalPersonalNoField + <*> aopt avsInternalPersonalNoField (fslI MsgAvsInternalPersonalNo) (avsPersonQueryInternalPersonalNo <$> tmpl) - + validateAvsQueryPerson :: FormValidator AvsQueryPerson Handler () validateAvsQueryPerson = do @@ -113,8 +113,12 @@ postAdminAvsR = do addMessage Info $ text2Html $ "Query: " <> tshow (toJSON fr) res <- avsQueryPerson fr case res of - Left err -> return . Just $ tshow err - Right jsn -> return . Just $ Text.replace "},Avs" "},\n Avs" $ tshow jsn + Left err -> let msg = tshow err in return $ Just [whamlet|

Error:

#{msg}|] + Right (AvsResponsePerson pns) -> return $ Just [whamlet| +