diff --git a/src/Handler/Course/Show.hs b/src/Handler/Course/Show.hs index a4ad7ed14..d5b24b951 100644 --- a/src/Handler/Course/Show.hs +++ b/src/Handler/Course/Show.hs @@ -23,7 +23,7 @@ import Handler.Course.Register getCShowR :: TermId -> SchoolId -> CourseShorthand -> Handler Html getCShowR tid ssh csh = do mbAid <- maybeAuthId - (cid,course,schoolName,participants,registration,defSFid,lecturers,assistants,correctors,tutors) <- runDB . maybeT notFound $ do + (cid,course,schoolName,participants,registration,defSFid,lecturers,assistants,correctors,tutors,mAllocation) <- runDB . maybeT notFound $ do [(E.Entity cid course, E.Value schoolName, E.Value participants, fmap entityVal -> registration)] <- lift . E.select . E.from $ \((school `E.InnerJoin` course) `E.LeftOuterJoin` participant) -> do @@ -61,7 +61,12 @@ getCShowR tid ssh csh = do 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) + mAllocation <- fmap (fmap entityVal . listToMaybe) . lift . E.select . E.from $ \(allocation `E.InnerJoin` allocationCourse) -> do + E.on $ allocation E.^. AllocationId E.==. allocationCourse E.^. AllocationCourseAllocation + E.where_ $ allocationCourse E.^. AllocationCourseCourse E.==. E.val cid + E.limit 1 + return allocation + return (cid,course,schoolName,participants,registration,entityKey <$> defSFid,lecturers,assistants,correctors,tutors,mAllocation) mRegFrom <- traverse (formatTime SelFormatDateTime) $ courseRegisterFrom course mRegTo <- traverse (formatTime SelFormatDateTime) $ courseRegisterTo course diff --git a/templates/course.hamlet b/templates/course.hamlet index c416e0efc..7e8b757e1 100644 --- a/templates/course.hamlet +++ b/templates/course.hamlet @@ -64,17 +64,21 @@ $# $if NTop (Just 0) < NTop (courseCapacity course) #{participants} $maybe capacity <- courseCapacity course \ von #{capacity} - $maybe regFrom <- mRegFrom -