diff --git a/src/Handler/Course/Users.hs b/src/Handler/Course/Users.hs index 1046b6bf9..9340955c5 100644 --- a/src/Handler/Course/Users.hs +++ b/src/Handler/Course/Users.hs @@ -89,7 +89,6 @@ instance HasEntity UserTableData User where hasEntity = _dbrOutput . _1 instance HasUser UserTableData where - -- hasUser = _entityVal hasUser = _dbrOutput . _1 . _entityVal _userTableRegistration :: Lens' UserTableData UTCTime @@ -334,6 +333,13 @@ makeCourseUserTable cid acts restrict colChoices psValidator csvColumns = do E.where_ $ participant E.^. TutorialParticipantUser E.==. user E.^. UserId return . E.min_ $ tutorial E.^. TutorialName ) + , single $ ("exams" , SortColumn $ queryUser >>> \user -> + E.subSelectMaybe . E.from $ \(exam `E.InnerJoin` examRegistration) -> do + E.on $ exam E.^. ExamId E.==. examRegistration E.^. ExamRegistrationExam + E.&&. exam E.^. ExamCourse E.==. E.val cid + E.where_ $ examRegistration E.^. ExamRegistrationUser E.==. user E.^. UserId + return . E.min_ $ exam E.^. ExamName + ) ] where single = uncurry Map.singleton dbtFilter = mconcat