display tutors on course page
This commit is contained in:
parent
caef74e955
commit
a0de628d9b
@ -280,7 +280,7 @@ getTermCourseListR tid = do
|
|||||||
getCShowR :: TermId -> SchoolId -> CourseShorthand -> Handler Html
|
getCShowR :: TermId -> SchoolId -> CourseShorthand -> Handler Html
|
||||||
getCShowR tid ssh csh = do
|
getCShowR tid ssh csh = do
|
||||||
mbAid <- maybeAuthId
|
mbAid <- maybeAuthId
|
||||||
(cid,course,schoolName,participants,registration,defSFid,lecturers,assistants,correctors) <- runDB . maybeT notFound $ do
|
(cid,course,schoolName,participants,registration,defSFid,lecturers,assistants,correctors,tutors) <- runDB . maybeT notFound $ do
|
||||||
[(E.Entity cid course, E.Value schoolName, E.Value participants, fmap entityVal -> registration)]
|
[(E.Entity cid course, E.Value schoolName, E.Value participants, fmap entityVal -> registration)]
|
||||||
<- lift . E.select . E.from $
|
<- lift . E.select . E.from $
|
||||||
\((school `E.InnerJoin` course) `E.LeftOuterJoin` participant) -> do
|
\((school `E.InnerJoin` course) `E.LeftOuterJoin` participant) -> do
|
||||||
@ -312,7 +312,13 @@ getCShowR tid ssh csh = do
|
|||||||
E.where_ $ sheet E.^. SheetCourse E.==. E.val cid
|
E.where_ $ sheet E.^. SheetCourse E.==. E.val cid
|
||||||
E.orderBy [ E.asc $ user E.^. UserSurname, E.asc $ user E.^. UserDisplayName ]
|
E.orderBy [ E.asc $ user E.^. UserSurname, E.asc $ user E.^. UserDisplayName ]
|
||||||
return ( user E.^. UserEmail, user E.^. UserDisplayName, user E.^. UserSurname )
|
return ( user E.^. UserEmail, user E.^. UserDisplayName, user E.^. UserSurname )
|
||||||
return (cid,course,schoolName,participants,registration,entityKey <$> defSFid,lecturers,assistants,correctors)
|
tutors <- fmap (map $(unValueN 3)) . lift . E.select $ E.from $ \(tutorial `E.InnerJoin` tutor `E.InnerJoin` user) -> E.distinctOnOrderBy [E.asc $ user E.^. UserSurname, E.asc $ user E.^. UserDisplayName, E.asc $ user E.^. UserEmail ] $ do
|
||||||
|
E.on $ tutor E.^. TutorUser E.==. user E.^. UserId
|
||||||
|
E.on $ tutor E.^. TutorTutorial E.==. tutorial E.^. TutorialId
|
||||||
|
E.where_ $ tutorial E.^. TutorialCourse E.==. E.val cid
|
||||||
|
E.orderBy [ E.asc $ user E.^. UserSurname, E.asc $ user E.^. UserDisplayName ]
|
||||||
|
return ( user E.^. UserEmail, user E.^. UserDisplayName, user E.^. UserSurname )
|
||||||
|
return (cid,course,schoolName,participants,registration,entityKey <$> defSFid,lecturers,assistants,correctors,tutors)
|
||||||
|
|
||||||
mRegFrom <- traverse (formatTime SelFormatDateTime) $ courseRegisterFrom course
|
mRegFrom <- traverse (formatTime SelFormatDateTime) $ courseRegisterFrom course
|
||||||
mRegTo <- traverse (formatTime SelFormatDateTime) $ courseRegisterTo course
|
mRegTo <- traverse (formatTime SelFormatDateTime) $ courseRegisterTo course
|
||||||
@ -338,14 +344,14 @@ getCShowR tid ssh csh = do
|
|||||||
[ sortable (Just "type") (i18nCell MsgTutorialType) $ \DBRow{ dbrOutput = Entity _ Tutorial{..} } -> textCell $ CI.original tutorialType
|
[ sortable (Just "type") (i18nCell MsgTutorialType) $ \DBRow{ dbrOutput = Entity _ Tutorial{..} } -> textCell $ CI.original tutorialType
|
||||||
, sortable (Just "name") (i18nCell MsgTutorialName) $ \DBRow{ dbrOutput = Entity _ Tutorial{..} } -> indicatorCell <> textCell (CI.original tutorialName)
|
, sortable (Just "name") (i18nCell MsgTutorialName) $ \DBRow{ dbrOutput = Entity _ Tutorial{..} } -> indicatorCell <> textCell (CI.original tutorialName)
|
||||||
, sortable Nothing (i18nCell MsgTutorialTutors) $ \DBRow{ dbrOutput = Entity tutid _ } -> sqlCell $ do
|
, sortable Nothing (i18nCell MsgTutorialTutors) $ \DBRow{ dbrOutput = Entity tutid _ } -> sqlCell $ do
|
||||||
tutors <- fmap (map $(unValueN 3)) . E.select . E.from $ \(tutor `E.InnerJoin` user) -> do
|
tutTutors <- fmap (map $(unValueN 3)) . E.select . E.from $ \(tutor `E.InnerJoin` user) -> do
|
||||||
E.on $ tutor E.^. TutorUser E.==. user E.^. UserId
|
E.on $ tutor E.^. TutorUser E.==. user E.^. UserId
|
||||||
E.where_ $ tutor E.^. TutorTutorial E.==. E.val tutid
|
E.where_ $ tutor E.^. TutorTutorial E.==. E.val tutid
|
||||||
return (user E.^. UserEmail, user E.^. UserDisplayName, user E.^. UserSurname)
|
return (user E.^. UserEmail, user E.^. UserDisplayName, user E.^. UserSurname)
|
||||||
return [whamlet|
|
return [whamlet|
|
||||||
$newline never
|
$newline never
|
||||||
<ul .list--iconless .list--inline .list--comma-separated>
|
<ul .list--iconless .list--inline .list--comma-separated>
|
||||||
$forall tutor <- tutors
|
$forall tutor <- tutTutors
|
||||||
<li>
|
<li>
|
||||||
^{nameEmailWidget' tutor}
|
^{nameEmailWidget' tutor}
|
||||||
|]
|
|]
|
||||||
|
|||||||
@ -33,6 +33,16 @@ $newline never
|
|||||||
<ul .list--inline .list--comma-separated>
|
<ul .list--inline .list--comma-separated>
|
||||||
$forall assi <- assistants
|
$forall assi <- assistants
|
||||||
<li>^{nameEmailWidget' assi}
|
<li>^{nameEmailWidget' assi}
|
||||||
|
|
||||||
|
$with numtutor <- length tutors
|
||||||
|
$if numtutor /= 0
|
||||||
|
<dt .deflist__dt>_{MsgTutorsFor numtutor}
|
||||||
|
<dd .deflist__dd>
|
||||||
|
<div>
|
||||||
|
<ul .list--inline .list--comma-separated>
|
||||||
|
$forall tutor <- tutors
|
||||||
|
<li>^{nameEmailWidget' tutor}
|
||||||
|
|
||||||
$with numcorrector <- length correctors
|
$with numcorrector <- length correctors
|
||||||
$if numcorrector /= 0
|
$if numcorrector /= 0
|
||||||
<dt .deflist__dt>_{MsgCorrectorsFor numcorrector}
|
<dt .deflist__dt>_{MsgCorrectorsFor numcorrector}
|
||||||
|
|||||||
Reference in New Issue
Block a user