diff --git a/messages/uniworx/de-de-formal.msg b/messages/uniworx/de-de-formal.msg index 33b1f8aca..ef18be62e 100644 --- a/messages/uniworx/de-de-formal.msg +++ b/messages/uniworx/de-de-formal.msg @@ -1446,6 +1446,7 @@ RGCourseLecturers: Kursverwalter RGCourseCorrectors: Korrektoren RGCourseTutors: Tutoren RGTutorialParticipants tutn@TutorialName: Tutorium-Teilnehmer (#{tutn}) +RGCourseUnacceptedApplicants: Nicht akzeptierte Bewerber MultiSelectFieldTip: Mehrfach-Auswahl ist möglich (Umschalt bzw. Strg) MultiEmailFieldTip: Es sind mehrere, Komma-separierte, E-Mail-Addressen möglich @@ -1926,6 +1927,7 @@ CsvColumnApplicationsAllocation: Zentralanmeldung über die die Bewerbung eingeg CsvColumnApplicationsApplication: Eindeutige Nummer der Bewerbung (zur Zuordnung im ZIP-Archiv aller Bewerbungsdateien) CsvColumnApplicationsName: Voller Name des Bewerbers CsvColumnApplicationsMatriculation: Matrikelnummer des Bewerbers +CsvColumnApplicationsEmail: E-Mail Adresse des Bewerbers CsvColumnApplicationsField: Studienfach, mit dem der Bewerber seine Bewerbung assoziiert hat CsvColumnApplicationsDegree: Abschluss, den der Bewerber im assoziierten Studienfach anstrebt CsvColumnApplicationsSemester: Fachsemester des Bewerbes im assoziierten Studienfach diff --git a/messages/uniworx/en-eu.msg b/messages/uniworx/en-eu.msg index 604bff30a..ae5b41733 100644 --- a/messages/uniworx/en-eu.msg +++ b/messages/uniworx/en-eu.msg @@ -1446,6 +1446,7 @@ RGCourseLecturers: Course administrators RGCourseCorrectors: Course correctors RGCourseTutors: Course tutors RGTutorialParticipants tutn: Tutorial participants (#{tutn}) +RGCourseUnacceptedApplicants: Applicants not accepted MultiSelectFieldTip: Multiple selections are possible (Shift or Ctrl) MultiEmailFieldTip: Multiple emails addresses may be specified (comma-separated) @@ -1925,6 +1926,7 @@ CsvColumnApplicationsAllocation: Central allocation for which this application w CsvColumnApplicationsApplication: Globally unique number of application (for matching with the ZIP archive of all application files) CsvColumnApplicationsName: Participant's full name CsvColumnApplicationsMatriculation: Participant's matriculation +CsvColumnApplicationsEmail: Participant's email address CsvColumnApplicationsField: Field of study the participant specified when applying CsvColumnApplicationsDegree: Degree the participant pursues in their associated field of study CsvColumnApplicationsSemester: Semester the participant is in wrt. to their associated field of study diff --git a/src/Handler/Course/Application/List.hs b/src/Handler/Course/Application/List.hs index 1c7cdf6c9..6a98c7e48 100644 --- a/src/Handler/Course/Application/List.hs +++ b/src/Handler/Course/Application/List.hs @@ -125,6 +125,7 @@ data CourseApplicationsTableCsv = CourseApplicationsTableCsv { csvCAAllocation :: Maybe AllocationShorthand , csvCAApplication :: Maybe CryptoFileNameCourseApplication , csvCAName :: Maybe Text + , csvCAEmail :: Maybe UserEmail , csvCAMatriculation :: Maybe Text , csvCAField :: Maybe Text , csvCADegree :: Maybe Text @@ -149,6 +150,7 @@ instance Csv.FromNamedRecord CourseApplicationsTableCsv where <$> csv .:?? "allocation" <*> csv .:?? "application" <*> csv .:?? "name" + <*> csv .:?? "email" <*> csv .:?? "matriculation" <*> csv .:?? "field" <*> csv .:?? "degree" @@ -167,6 +169,7 @@ instance CsvColumnsExplained CourseApplicationsTableCsv where [ ('csvCAAllocation , MsgCsvColumnApplicationsAllocation ) , ('csvCAApplication , MsgCsvColumnApplicationsApplication ) , ('csvCAName , MsgCsvColumnApplicationsName ) + , ('csvCAEmail , MsgCsvColumnApplicationsEmail ) , ('csvCAMatriculation, MsgCsvColumnApplicationsMatriculation) , ('csvCAField , MsgCsvColumnApplicationsField ) , ('csvCADegree , MsgCsvColumnApplicationsDegree ) @@ -320,6 +323,7 @@ postCApplicationsR tid ssh csh = do , emptyOpticColonnade (resultAllocation . _entityVal) $ \l -> anchorColonnade (views l allocationLink) $ colAllocationShorthand (l . _allocationShorthand) , anchorColonnadeM (views (resultCourseApplication . _entityKey) applicationLink) $ colApplicationId (resultCourseApplication . _entityKey) , anchorColonnadeM (views (resultUser . _entityKey) participantLink) $ colUserDisplayName (resultUser . _entityVal . $(multifocusL 2) _userDisplayName _userSurname) + , lmap (view $ resultUser . _entityVal) colUserEmail , colUserMatriculation (resultUser . _entityVal . _userMatrikelnummer) , emptyOpticColonnade (resultStudyTerms . _entityVal) colStudyTerms , emptyOpticColonnade (resultStudyDegree . _entityVal) colStudyDegree @@ -335,6 +339,7 @@ postCApplicationsR tid ssh csh = do [ singletonMap "participant" . SortColumn $ view queryIsParticipant , sortAllocationShorthand $ queryAllocation . to (E.?. AllocationShorthand) , sortUserName' $ $(multifocusG 2) (queryUser . to (E.^. UserDisplayName)) (queryUser . to (E.^. UserSurname)) + , uncurry singletonMap . sortUserEmail $ view queryUser , sortUserMatriculation $ queryUser . to (E.^. UserMatrikelnummer) , sortStudyTerms queryStudyTerms , sortStudyDegree queryStudyDegree @@ -349,6 +354,7 @@ postCApplicationsR tid ssh csh = do dbtFilter = mconcat [ fltrAllocation queryAllocation , fltrUserName' $ queryUser . to (E.^. UserDisplayName) + , uncurry singletonMap . fltrUserEmail $ view queryUser , fltrUserMatriculation $ queryUser . to (E.^. UserMatrikelnummer) , fltrStudyTerms queryStudyTerms , fltrStudyDegree queryStudyDegree @@ -363,6 +369,7 @@ postCApplicationsR tid ssh csh = do [ fltrAllocationUI , fltrUserNameUI' , fltrUserMatriculationUI + , fltrUserEmailUI , fltrStudyTermsUI , fltrStudyDegreeUI , fltrStudyFeaturesSemesterUI @@ -382,6 +389,7 @@ postCApplicationsR tid ssh csh = do <$> preview (resultAllocation . _entityVal . _allocationShorthand) <*> (preview (resultCourseApplication . _entityKey) >>= traverse encrypt) <*> preview (resultUser . _entityVal . _userDisplayName) + <*> preview (resultUser . _entityVal . _userEmail) <*> preview (resultUser . _entityVal . _userMatrikelnummer . _Just) <*> preview (resultStudyTerms . _entityVal . (_studyTermsName . _Just <> _studyTermsShorthand . _Just <> to (tshow . studyTermsKey))) <*> preview (resultStudyDegree . _entityVal . (_studyDegreeName . _Just <> _studyDegreeShorthand . _Just <> to (tshow . studyDegreeKey))) @@ -505,6 +513,7 @@ postCApplicationsR tid ssh csh = do users <- E.select . E.from $ \user -> do E.where_ . E.and $ catMaybes [ (user E.^. UserMatrikelnummer E.==.) . E.val . Just <$> csvCAMatriculation + , (user E.^. UserEmail E.==.) . E.val <$> csvCAEmail , (user E.^. UserDisplayName E.==.) . E.val <$> csvCAName ] return $ user E.^. UserId diff --git a/src/Handler/Course/Communication.hs b/src/Handler/Course/Communication.hs index a984f021e..0833d1f35 100644 --- a/src/Handler/Course/Communication.hs +++ b/src/Handler/Course/Communication.hs @@ -15,14 +15,25 @@ import qualified Database.Esqueleto as E getCCommR, postCCommR :: TermId -> SchoolId -> CourseShorthand -> Handler Html getCCommR = postCCommR postCCommR tid ssh csh = do - cid <- runDB . getKeyBy404 $ TermSchoolCourseShort tid ssh csh + (cid, tuts) <- runDB $ do + cid <- getKeyBy404 $ TermSchoolCourseShort tid ssh csh + tuts' <- selectKeysList [TutorialCourse ==. cid] [] + tuts <- forM tuts' $ \tutid -> do + cID <- encrypt tutid + return ( RGTutorialParticipants cID + , E.from $ \(user `E.InnerJoin` participant) -> do + E.on $ user E.^. UserId E.==. participant E.^. TutorialParticipantUser + E.where_ $ participant E.^. TutorialParticipantTutorial E.==. E.val tutid + return user + ) + return (cid, tuts) commR CommunicationRoute { crHeading = SomeMessage . prependCourseTitle tid ssh csh $ SomeMessage MsgCommCourseHeading , crUltDest = SomeRoute $ CourseR tid ssh csh CCommR , crJobs = crJobsCourseCommunication cid , crTestJobs = crTestJobsCourseCommunication cid - , crRecipients = Map.fromList + , crRecipients = Map.fromList $ [ ( RGCourseParticipants , E.from $ \(user `E.InnerJoin` participant) -> do E.on $ user E.^. UserId E.==. participant E.^. CourseParticipantUser @@ -52,7 +63,18 @@ postCCommR tid ssh csh = do E.&&. user E.^. UserId E.==. tutor E.^. TutorUser return user ) - ] + , ( RGCourseUnacceptedApplicants + , E.from $ \user -> do + E.where_ . E.exists . E.from $ \courseApplication -> + E.where_ $ courseApplication E.^. CourseApplicationCourse E.==. E.val cid + E.&&. courseApplication E.^. CourseApplicationUser E.==. user E.^. UserId + E.where_ . E.not_ . E.exists . E.from $ \courseParticipant -> + E.where_ $ courseParticipant E.^. CourseParticipantCourse E.==. E.val cid + E.&&. courseParticipant E.^. CourseParticipantUser E.==. user E.^. UserId + E.&&. courseParticipant E.^. CourseParticipantState E.==. E.val CourseParticipantActive + return user + ) + ] ++ tuts , crRecipientAuth = Just $ \uid -> do cID <- encrypt uid evalAccessDB (CourseR tid ssh csh $ CUserR cID) False diff --git a/src/Handler/Utils/Communication.hs b/src/Handler/Utils/Communication.hs index ae8884874..66effed5c 100644 --- a/src/Handler/Utils/Communication.hs +++ b/src/Handler/Utils/Communication.hs @@ -22,7 +22,7 @@ import qualified Data.Set as Set import qualified Data.Conduit.Combinators as C -data RecipientGroup = RGCourseParticipants | RGCourseLecturers | RGCourseCorrectors | RGCourseTutors +data RecipientGroup = RGCourseParticipants | RGCourseLecturers | RGCourseCorrectors | RGCourseTutors | RGCourseUnacceptedApplicants | RGTutorialParticipants CryptoUUIDTutorial deriving (Eq, Ord, Read, Show, Generic, Typeable) diff --git a/templates/widgets/communication/recipientLayout.hamlet b/templates/widgets/communication/recipientLayout.hamlet index e7e278f13..416cbc1d5 100644 --- a/templates/widgets/communication/recipientLayout.hamlet +++ b/templates/widgets/communication/recipientLayout.hamlet @@ -18,6 +18,8 @@ $if not (null activeCategories) _{MsgRGCourseTutors} $of RecipientGroup (RGTutorialParticipants tutid) ^{rgTutorialParticipantsCaption tutid} + $of RecipientGroup RGCourseUnacceptedApplicants + _{MsgRGCourseUnacceptedApplicants} $if hasContent category