From 1bc14c9e19c5c165c735f9c3d00062fb1dcf6077 Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Mon, 2 Mar 2020 15:00:40 +0100 Subject: [PATCH] fix(course-users): add missing dbt sorting --- src/Handler/Course/Users.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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