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