Show Participant association on profile page

This commit is contained in:
SJost 2018-06-20 15:31:45 +02:00
parent b5e849af64
commit 8b46a690a8
5 changed files with 28 additions and 5 deletions

View File

@ -69,6 +69,7 @@ import System.FilePath
import Handler.Utils.Templates import Handler.Utils.Templates
import Handler.Utils.StudyFeatures import Handler.Utils.StudyFeatures
import Handler.Utils.DateTime
import Control.Lens import Control.Lens
import Utils.Lens import Utils.Lens
@ -76,7 +77,8 @@ import Utils.Lens
instance DisplayAble TermId where instance DisplayAble TermId where
display = termToText . unTermKey display = termToText . unTermKey
instance DisplayAble UTCTime where
display = pack . formatTimeGerDT2 -- default Time Format to be used: 00.00.00 00:00
-- infixl 9 :$: -- infixl 9 :$:
-- pattern a :$: b = a b -- pattern a :$: b = a b

View File

@ -20,7 +20,7 @@ getProfileR :: Handler Html
getProfileR = do getProfileR = do
(uid, User{..}) <- requireAuthPair (uid, User{..}) <- requireAuthPair
mr <- getMessageRender mr <- getMessageRender
(admin_rights,lecturer_rights,lecture_owner,lecture_corrector,studies) <- runDB $ (,,,,) <$> (admin_rights,lecturer_rights,lecture_owner,lecture_corrector,participant,studies) <- runDB $ (,,,,,) <$>
(E.select $ E.from $ \(adright `E.InnerJoin` school) -> do (E.select $ E.from $ \(adright `E.InnerJoin` school) -> do
E.where_ $ adright ^. UserAdminUser E.==. E.val uid E.where_ $ adright ^. UserAdminUser E.==. E.val uid
E.on $ adright ^. UserAdminSchool E.==. school ^. SchoolId E.on $ adright ^. UserAdminSchool E.==. school ^. SchoolId
@ -45,6 +45,12 @@ getProfileR = do
return (course ^. CourseShorthand, course ^. CourseTerm) return (course ^. CourseShorthand, course ^. CourseTerm)
) )
<*> <*>
(E.select $ E.from $ \(participant `E.InnerJoin` course) -> do
E.where_ $ participant ^. CourseParticipantUser E.==. E.val uid
E.on $ participant ^. CourseParticipantCourse E.==. course ^. CourseId
return (course ^. CourseShorthand, course ^. CourseTerm, participant ^. CourseParticipantRegistration)
)
<*>
(E.select $ E.from $ \(studydegree `E.InnerJoin` studyfeat `E.InnerJoin` studyterms) -> do (E.select $ E.from $ \(studydegree `E.InnerJoin` studyfeat `E.InnerJoin` studyterms) -> do
E.where_ $ studyfeat ^. StudyFeaturesUser E.==. E.val uid E.where_ $ studyfeat ^. StudyFeaturesUser E.==. E.val uid
E.on $ studyfeat ^. StudyFeaturesField E.==. studyterms ^. StudyTermsId E.on $ studyfeat ^. StudyFeaturesField E.==. studyterms ^. StudyTermsId

View File

@ -43,8 +43,11 @@ formatTimeGerDTlong = formatTimeGer "%A, %e. %B %Y, %k:%M:%S"
formatTimeGerWDT :: FormatTime t => t -> String formatTimeGerWDT :: FormatTime t => t -> String
formatTimeGerWDT = formatTimeGer $ dateTimeFmt germanTimeLocale formatTimeGerWDT = formatTimeGer $ dateTimeFmt germanTimeLocale
formatTimeGerDT :: FormatTime t => t -> String formatTimeGerDT :: FormatTime t => t -> String -- 0.00.00 0:00
formatTimeGerDT = formatTimeGer "%e.%m.%y %k:%M" formatTimeGerDT = formatTimeGer "%e.%m.%y %k:%M" -- leading spaces at start, otherwise 0 padding
formatTimeGerDT2 :: FormatTime t => t -> String -- 00.00.00 00:00
formatTimeGerDT2 = formatTimeGer "%d.%m.%y %H:%M" -- always padding with 0
formatTimeGerWD :: FormatTime t => t -> String formatTimeGerWD :: FormatTime t => t -> String
formatTimeGerWD = formatTimeGer "%a %e.%m.%y" formatTimeGerWD = formatTimeGer "%a %e.%m.%y"

View File

@ -91,6 +91,8 @@ instance DisplayAble Text where
instance DisplayAble String where instance DisplayAble String where
display = pack display = pack
instance DisplayAble a => DisplayAble (Maybe a) where instance DisplayAble a => DisplayAble (Maybe a) where
display Nothing = "" display Nothing = ""
display (Just x) = display x display (Just x) = display x

View File

@ -34,7 +34,17 @@
$forall (E.Value csh, E.Value tid) <- lecture_corrector $forall (E.Value csh, E.Value tid) <- lecture_corrector
<li> <li>
<a href=@{CourseR tid csh CShowR}>#{display tid} - #{csh} <a href=@{CourseR tid csh CShowR}>#{display tid} - #{csh}
<h2>
Kursteilnehmer:
<ul>
$forall (E.Value csh, E.Value tid, regSince) <- participant
<li>
<a href=@{CourseR tid csh CShowR}>#{display tid} - #{csh}
registriert seit #{display regSince}
<h2>
Abgegebene Übungsblätter:
TODO
<p> <p>
<h1> <h1>
Benutzerdaten Benutzerdaten
@ -59,7 +69,7 @@
<h4>Hinweise: <h4>Hinweise:
<ul> <ul>
<li> <li>
Nicht aufgeführt sind Zeitstempel mit Benutzerinformationen, z.B. bei der Editierung von Übungen Nicht aufgeführt sind Zeitstempel mit Benutzerinformationen, z.B. bei der Editierung und Korrekturen von Übungen, Übungsgruppenleiterschaft, Raumbuchungen, etc.
<li> <li>
Benutzerdaten bleiben so lange gespeichert, bis ein Institutsadministrator über die Exmatrikulation informiert wurde. Dann wird der Account gelöscht. Benutzerdaten bleiben so lange gespeichert, bis ein Institutsadministrator über die Exmatrikulation informiert wurde. Dann wird der Account gelöscht.
Abgaben/Bonuspunkte werden unwiderruflich gelöscht. Abgaben/Bonuspunkte werden unwiderruflich gelöscht.