From f20f2cb0054228eb75e856cef79e1452e9fe9218 Mon Sep 17 00:00:00 2001 From: SJost Date: Wed, 27 Feb 2019 12:14:06 +0100 Subject: [PATCH] Minor clean up --- models/users | 6 +++--- src/Handler/Course.hs | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/models/users b/models/users index bddb5c4a8..f93b954d4 100644 --- a/models/users +++ b/models/users @@ -25,19 +25,19 @@ UserLecturer user UserId school SchoolId UniqueSchoolLecturer user school -StudyFeatures +StudyFeatures -- Abschluss, Studiengang, Haupt/Nebenfachh und Fachsemester user UserId degree StudyDegreeId field StudyTermsId type StudyFieldType semester Int -- UniqueUserSubject user degree field -- There exists a counterexample -StudyDegree +StudyDegree -- Studienabschluss key Int shorthand Text Maybe name Text Maybe Primary key -StudyTerms +StudyTerms -- Studiengang key Int shorthand Text Maybe name Text Maybe diff --git a/src/Handler/Course.hs b/src/Handler/Course.hs index e635731b3..c5ded719d 100644 --- a/src/Handler/Course.hs +++ b/src/Handler/Course.hs @@ -626,7 +626,7 @@ validateCourse CourseForm{..} = type UserTableExpr = (E.SqlExpr (Entity User) `E.InnerJoin` E.SqlExpr (Entity CourseParticipant)) `E.LeftOuterJoin` E.SqlExpr (Maybe (Entity CourseUserNote)) type UserTableWhere = UserTableExpr -> E.SqlExpr (E.Value Bool) -type UserTableData = DBRow (Entity User, E.Value UTCTime, E.Value (Maybe CourseUserNoteId)) +type UserTableData = DBRow (Entity User, UTCTime, Maybe CourseUserNoteId) forceUserTableType :: (UserTableExpr -> a) -> (UserTableExpr -> a) forceUserTableType = id @@ -649,10 +649,10 @@ instance HasUser UserTableData where hasUser = _dbrOutput . _1 . _entityVal _userTableRegistration :: Lens' UserTableData UTCTime -_userTableRegistration = _dbrOutput . _2 . _unValue +_userTableRegistration = _dbrOutput . _2 _userTableNote :: Lens' UserTableData (Maybe CourseUserNoteId) -_userTableNote = _dbrOutput . _3 . _unValue +_userTableNote = _dbrOutput . _3 -- default Where-Clause courseIs :: CourseId -> UserTableWhere @@ -662,7 +662,7 @@ courseIs cid ((_user `E.InnerJoin` participant) `E.LeftOuterJoin` _note) = parti colUserComment :: IsDBTable m c => TermId -> SchoolId -> CourseShorthand -> Colonnade Sortable UserTableData (DBCell m c) colUserComment tid ssh csh = sortable (Just "course-user-note") (i18nCell MsgCourseUserNote) - $ \DBRow{ dbrOutput=(Entity uid _, _, E.Value mbNoteKey) } -> + $ \DBRow{ dbrOutput=(Entity uid _, _, mbNoteKey) } -> maybeEmpty mbNoteKey $ const $ anchorCellM (courseLink <$> encrypt uid) (toWidget $ hasComment True) where @@ -687,7 +687,7 @@ makeCourseUserTable whereClause colChoices psValidator = dbtStyle = def dbtSQLQuery = userTableQuery whereClause dbtRowKey ((user `E.InnerJoin` _participant) `E.LeftOuterJoin` _note) = user E.^. UserId - dbtProj = return -- . dbrOutput -- NOT SURE + dbtProj = traverse $ \(user, E.Value registrationTime , E.Value userNoteId) -> return (user, registrationTime, userNoteId) dbtColonnade = colChoices dbtSorting = Map.fromList [] -- TODO dbtFilter = Map.fromList [] -- TODO