Courselist must show school as well!

This commit is contained in:
SJost 2018-08-01 19:24:18 +02:00
parent 47d74577bc
commit 99354919ba

View File

@ -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