refactor(UniWorxMessages): eliminate superfluous whitespace

also: some tutorial code cleaning
This commit is contained in:
Steffen Jost 2025-01-28 11:03:03 +01:00 committed by Sarah Vaupel
parent ad12b8f927
commit e5cf120af2
4 changed files with 13 additions and 13 deletions

View File

@ -1,4 +1,4 @@
-- SPDX-FileCopyrightText: 2022-23 Gregor Kleen <gregor.kleen@ifi.lmu.de>,Sarah Vaupel <sarah.vaupel@ifi.lmu.de>,Sarah Vaupel <vaupel.sarah@campus.lmu.de>,Steffen Jost <s.jost@fraport.de>,Steffen Jost <jost@tcs.ifi.lmu.de>,Winnie Ros <winnie.ros@campus.lmu.de>
-- SPDX-FileCopyrightText: 2022-25 Gregor Kleen <gregor.kleen@ifi.lmu.de>,Sarah Vaupel <sarah.vaupel@ifi.lmu.de>,Sarah Vaupel <vaupel.sarah@campus.lmu.de>,Steffen Jost <s.jost@fraport.de>,Steffen Jost <jost@tcs.ifi.lmu.de>,Winnie Ros <winnie.ros@campus.lmu.de>
--
-- SPDX-License-Identifier: AGPL-3.0-or-later
@ -549,7 +549,7 @@ instance IsList UniWorXMessages where
instance RenderMessage UniWorX UniWorXMessages where
renderMessage foundation ls (UniWorXMessages msgs) =
Text.unwords $ map (renderMessage foundation ls) msgs
Text.concat $ map (renderMessage foundation ls) msgs -- Text.unwords for blank separation, Text.concat without
uniworxMessages :: [UniWorXMessage] -> UniWorXMessages
uniworxMessages = UniWorXMessages . map SomeMessage

View File

@ -129,7 +129,7 @@ assignHandler tid ssh csh cid assignSids = do
alert_ok = toMaybe (nr_ok > 0) $ SomeMessage $ MsgUpdatedSheetCorrectorsAutoAssigned nr_ok
alert_fail = toMaybe (nr_fail > 0) $ SomeMessage $ MsgUpdatedSheetCorrectorsAutoFailed nr_fail
msg_status = bool Success Error $ nr_fail > 0
msg_header = SomeMessage $ shn <> ":"
msg_header = SomeMessage $ shn <> ": "
if | nr_ok > 0 || nr_fail > 0 -> do
addMessageI msg_status $ UniWorXMessages $ msg_header : catMaybes [alert_ok, alert_fail]
return $ Just status

View File

@ -1,10 +1,9 @@
-- SPDX-FileCopyrightText: 2022-23 Gregor Kleen <gregor.kleen@ifi.lmu.de>,Sarah Vaupel <sarah.vaupel@ifi.lmu.de>,Steffen Jost <s.jost@fraport.de>
-- SPDX-FileCopyrightText: 2022-25 Gregor Kleen <gregor.kleen@ifi.lmu.de>,Sarah Vaupel <sarah.vaupel@ifi.lmu.de>,Steffen Jost <s.jost@fraport.de>
--
-- SPDX-License-Identifier: AGPL-3.0-or-later
{-# LANGUAGE TypeApplications, BlockArguments #-}
{-# OPTIONS_GHC -Wno-error=unused-local-binds -Wno-error=unused-matches #-}
module Handler.Tutorial.Users
( getTUsersR, postTUsersR
@ -287,7 +286,7 @@ getTExamR, postTExamR :: TermId -> SchoolId -> CourseShorthand -> TutorialName -
getTExamR = postTExamR
postTExamR tid ssh csh tutn exmName = do
let baseroute = CTutorialR tid ssh csh tutn
(cid,tutEnt,Entity{entityKey=eId,entityVal=exm},exOccs) <- runDB do
(Entity{entityKey=eId,entityVal=exm},exOccs) <- runDB do
trm <- get404 tid
(cid, tutEnt) <- fetchCourseIdTutorial tid ssh csh tutn
exm <- getBy404 $ UniqueExam cid exmName
@ -296,7 +295,7 @@ postTExamR tid ssh csh tutn exmName = do
-- (fmap (toMidnight . succ) -> tbegin, fmap toMidnight -> tend) = munzip timespan
-- exms <- selectList ([ExamCourse ==. cid, ExamStart <=. tend] ++ ([ExamEnd >=. tbegin] ||. [ExamEnd ==. Nothing])) [Asc ExamName]
exOccs <- flip foldMapM timespan $ getDayExamOccurrences False ssh $ Just cid
return (cid,tutEnt,exm,exOccs)
return (exm,exOccs)
cueId :: CryptoUUIDExam <- encrypt eId
let eid2eos = convertExamOccurrenceMap exOccs
(cuEoIds, eos) = munzip $ Map.lookup eId eid2eos
@ -320,10 +319,11 @@ postTExamR tid ssh csh tutn exmName = do
addMessageI mstat $ MsgExamOccurrencesEdited nrUps nrDel
reload $ baseroute $ TExamR exmName
let heading = prependCourseTitle tid ssh csh $ CI.original $ tutorialName $ entityVal tutEnt
-- let heading = prependCourseTitle tid ssh csh $ tutEnt ^. _entityVal . _tutorialName . _CI
siteLayoutMsg (MsgMenuTutorialExam exmName) do
setTitle $ citext2Html exmName
let csh_tutn = csh <> "-" <> tutn -- hack to reuse prependCourseTitle
heading = prependCourseTitle tid ssh csh_tutn $ MsgMenuTutorialExam exmName
siteLayoutMsg heading do
-- setTitle $ citext2Html exmName
setTitleI heading
[whamlet|
<section>
<h2>#{CI.original exmName}

View File

@ -1,4 +1,4 @@
-- SPDX-FileCopyrightText: 2023-24 Gregor Kleen <gregor.kleen@ifi.lmu.de>,Steffen Jost <jost@tcs.ifi.lmu.de>,Winnie Ros <winnie.ros@campus.lmu.de>,Steffen Jost <s.jost@fraport.de>
-- SPDX-FileCopyrightText: 2023-25 Gregor Kleen <gregor.kleen@ifi.lmu.de>,Steffen Jost <jost@tcs.ifi.lmu.de>,Winnie Ros <winnie.ros@campus.lmu.de>,Steffen Jost <s.jost@fraport.de>
--
-- SPDX-License-Identifier: AGPL-3.0-or-later
@ -64,7 +64,7 @@ prependCourseTitle tid ssh csh msg = UniWorXMessages
dashText = "-"
colonText :: Text
colonText = ":"
colonText = ": "
warnTermDays :: (RenderMessage UniWorX msg) => TermId -> Map UTCTime msg -> DB ()
warnTermDays tid timeNames = do