From 99354919ba7fe549c493797d523e1061eb35190d Mon Sep 17 00:00:00 2001 From: SJost Date: Wed, 1 Aug 2018 19:24:18 +0200 Subject: [PATCH] Courselist must show school as well! --- src/Handler/Course.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Handler/Course.hs b/src/Handler/Course.hs index 10caec1b0..df9d45ba0 100644 --- a/src/Handler/Course.hs +++ b/src/Handler/Course.hs @@ -77,6 +77,11 @@ course2Participants course = E.sub_select . E.from $ \courseParticipant -> do E.where_ $ courseParticipant E.^. CourseParticipantCourse E.==. course E.^. CourseId return (E.countRows :: E.SqlExpr (E.Value Int64)) +course2School :: CourseTableExpr -> E.SqlExpr _ -- this is a bad hack, change to proper innerjoin +course2School course = E.subList_select . E.from $ \school -> do + E.where_ $ course E.^. CourseSchool E.==. school E.^. SchoolId + return (school E.^. SchoolShorthand) + course2Registered :: Maybe UserId -> CourseTableExpr -> E.SqlExpr (E.Value Bool) course2Registered muid course = E.exists . E.from $ \courseParticipant -> do E.where_ $ courseParticipant E.^. CourseParticipantCourse E.==. course E.^. CourseId