From ebcb23429ff09c56ba4a00a6cb8f082ee83e1fe8 Mon Sep 17 00:00:00 2001 From: ros Date: Sun, 22 Aug 2021 15:49:37 +0200 Subject: [PATCH 1/3] feat(tutoriumsdaten): termin --- src/Handler/Tutorial/Users.hs | 2 +- templates/tutorial-participants.hamlet | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Handler/Tutorial/Users.hs b/src/Handler/Tutorial/Users.hs index f8215a0d9..cc34b1d6a 100644 --- a/src/Handler/Tutorial/Users.hs +++ b/src/Handler/Tutorial/Users.hs @@ -55,7 +55,7 @@ postTUsersR tid ssh csh tutn = do cid <- getKeyBy404 $ TermSchoolCourseShort tid ssh csh table <- makeCourseUserTable cid (Map.fromList $ map (id &&& pure) universeF) isInTut colChoices psValidator (Just csvColChoices) return (tut, table) - + formResult participantRes $ \case (TutorialUserSendMail, selectedUsers) -> do cids <- traverse encrypt $ Set.toList selectedUsers :: Handler [CryptoUUIDUser] diff --git a/templates/tutorial-participants.hamlet b/templates/tutorial-participants.hamlet index 1c6999f09..697d9f6a7 100644 --- a/templates/tutorial-participants.hamlet +++ b/templates/tutorial-participants.hamlet @@ -1,2 +1,8 @@ $newline never +
+
+
_{MsgTableTutorialTime} +
+ ^{occurrencesWidget tutorialTime} +
_{MsgTableTutorialTutors} ^{participantTable} From e972788f540a9ce6c3fdf841313057b62a579d72 Mon Sep 17 00:00:00 2001 From: ros Date: Sun, 29 Aug 2021 14:14:21 +0200 Subject: [PATCH 2/3] feat(tutoriumsdaten): firts draft --- src/Application.hs | 1 + src/Handler/Tutorial/Users.hs | 8 +++++++- templates/tutorial-participants.hamlet | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Application.hs b/src/Application.hs index 7d02e6009..e4e2d4b1c 100644 --- a/src/Application.hs +++ b/src/Application.hs @@ -719,3 +719,4 @@ addPWEntry User{ userAuthentication = _, ..} (Text.encodeUtf8 -> pw) = db' $ do PWHashConf{..} <- getsYesod $ view _appAuthPWHash (AuthPWHash . Text.decodeUtf8 -> userAuthentication) <- liftIO $ makePasswordWith pwHashAlgorithm pw pwHashStrength void $ insert User{..} + diff --git a/src/Handler/Tutorial/Users.hs b/src/Handler/Tutorial/Users.hs index cc34b1d6a..eb15e4e84 100644 --- a/src/Handler/Tutorial/Users.hs +++ b/src/Handler/Tutorial/Users.hs @@ -55,7 +55,7 @@ postTUsersR tid ssh csh tutn = do cid <- getKeyBy404 $ TermSchoolCourseShort tid ssh csh table <- makeCourseUserTable cid (Map.fromList $ map (id &&& pure) universeF) isInTut colChoices psValidator (Just csvColChoices) return (tut, table) - + formResult participantRes $ \case (TutorialUserSendMail, selectedUsers) -> do cids <- traverse encrypt $ Set.toList selectedUsers :: Handler [CryptoUUIDUser] @@ -67,6 +67,12 @@ postTUsersR tid ssh csh tutn = do ] addMessageI Success $ MsgTutorialUsersDeregistered nrDel redirect $ CTutorialR tid ssh csh tutn TUsersR + + tutors <- runDB $ + E.select $ E.from $ \(tutor `E.InnerJoin` user) -> do + E.on $ tutor E.^. TutorUser E.==. user E.^. UserId + E.where_ $ tutor E.^. TutorTutorial E.==. E.val tutid + return user let heading = prependCourseTitle tid ssh csh $ CI.original tutorialName siteLayoutMsg heading $ do diff --git a/templates/tutorial-participants.hamlet b/templates/tutorial-participants.hamlet index 697d9f6a7..a5ca27d35 100644 --- a/templates/tutorial-participants.hamlet +++ b/templates/tutorial-participants.hamlet @@ -5,4 +5,9 @@ $newline never
^{occurrencesWidget tutorialTime}
_{MsgTableTutorialTutors} +
+
    + $forall (Entity _ User{userDisplayName, userDisplayEmail, userSurname}) <- tutors +
  • + ^{nameEmailWidget userDisplayEmail userDisplayName userSurname} ^{participantTable} From d4a73e699a399b02cadcea03e614c789671ee6d1 Mon Sep 17 00:00:00 2001 From: ros Date: Sun, 29 Aug 2021 14:20:39 +0200 Subject: [PATCH 3/3] feat(tutoriumsdaten): application restore --- src/Application.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Application.hs b/src/Application.hs index e4e2d4b1c..7d02e6009 100644 --- a/src/Application.hs +++ b/src/Application.hs @@ -719,4 +719,3 @@ addPWEntry User{ userAuthentication = _, ..} (Text.encodeUtf8 -> pw) = db' $ do PWHashConf{..} <- getsYesod $ view _appAuthPWHash (AuthPWHash . Text.decodeUtf8 -> userAuthentication) <- liftIO $ makePasswordWith pwHashAlgorithm pw pwHashStrength void $ insert User{..} -