Show Lecture/Corrector associations on profile page

This commit is contained in:
SJost 2018-06-20 15:09:44 +02:00
parent a12d3457c0
commit b5e849af64
4 changed files with 38 additions and 1 deletions

View File

@ -72,6 +72,12 @@ import Handler.Utils.StudyFeatures
import Control.Lens import Control.Lens
import Utils.Lens import Utils.Lens
-- -- TODO: Move me to appropriate Place
instance DisplayAble TermId where
display = termToText . unTermKey
-- 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,studies) <- runDB $ (,,) <$> (admin_rights,lecturer_rights,lecture_owner,lecture_corrector,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
@ -33,6 +33,18 @@ getProfileR = do
return (school ^. SchoolName) return (school ^. SchoolName)
) )
<*> <*>
(E.select $ E.from $ \(lecturer `E.InnerJoin` course) -> do
E.where_ $ lecturer ^. LecturerUser E.==. E.val uid
E.on $ lecturer ^. LecturerCourse E.==. course ^. CourseId
return (course ^. CourseShorthand, course ^. CourseTerm)
)
<*>
(E.select $ E.from $ \(corrector `E.InnerJoin` course) -> do
E.where_ $ corrector ^. CorrectorUser E.==. E.val uid
E.on $ corrector ^. CorrectorCourse E.==. course ^. CourseId
return (course ^. CourseShorthand, course ^. CourseTerm)
)
<*>
(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

@ -130,6 +130,9 @@ data TermIdentifier = TermIdentifier
-- from_TermId_to_TermIdentifier = unTermKey -- from_TermId_to_TermIdentifier = unTermKey
-- from_TermIdentifier_to_TermId = TermKey -- from_TermIdentifier_to_TermId = TermKey
instance DisplayAble TermIdentifier where
display = termToText
--TODO: Enforce the number of digits within year, with parsing filling in the current leading digits? Goal: short urls --TODO: Enforce the number of digits within year, with parsing filling in the current leading digits? Goal: short urls
termToText :: TermIdentifier -> Text termToText :: TermIdentifier -> Text
termToText TermIdentifier{..} = Text.pack $ seasonToChar season : show year termToText TermIdentifier{..} = Text.pack $ seasonToChar season : show year

View File

@ -21,6 +21,20 @@
<ul> <ul>
$forall institute <- lecturer_rights $forall institute <- lecturer_rights
<li>#{display institute} <li>#{display institute}
<h2>
Zugriffsberechtigung als Lehrender auf:
<ul>
$forall (E.Value csh, E.Value tid) <- lecture_owner
<li>
<a href=@{CourseR tid csh CShowR}>#{display tid} - #{csh}
<h2>
Zugriffsberechtigung als Korrekor auf:
<ul>
$forall (E.Value csh, E.Value tid) <- lecture_corrector
<li>
<a href=@{CourseR tid csh CShowR}>#{display tid} - #{csh}
<p> <p>
<h1> <h1>
Benutzerdaten Benutzerdaten
@ -44,6 +58,8 @@
<p> <p>
<h4>Hinweise: <h4>Hinweise:
<ul> <ul>
<li>
Nicht aufgeführt sind Zeitstempel mit Benutzerinformationen, z.B. bei der Editierung von Übungen
<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.