Minor clean up
This commit is contained in:
parent
2ce657fe5e
commit
f20f2cb005
@ -25,19 +25,19 @@ UserLecturer
|
|||||||
user UserId
|
user UserId
|
||||||
school SchoolId
|
school SchoolId
|
||||||
UniqueSchoolLecturer user school
|
UniqueSchoolLecturer user school
|
||||||
StudyFeatures
|
StudyFeatures -- Abschluss, Studiengang, Haupt/Nebenfachh und Fachsemester
|
||||||
user UserId
|
user UserId
|
||||||
degree StudyDegreeId
|
degree StudyDegreeId
|
||||||
field StudyTermsId
|
field StudyTermsId
|
||||||
type StudyFieldType
|
type StudyFieldType
|
||||||
semester Int
|
semester Int
|
||||||
-- UniqueUserSubject user degree field -- There exists a counterexample
|
-- UniqueUserSubject user degree field -- There exists a counterexample
|
||||||
StudyDegree
|
StudyDegree -- Studienabschluss
|
||||||
key Int
|
key Int
|
||||||
shorthand Text Maybe
|
shorthand Text Maybe
|
||||||
name Text Maybe
|
name Text Maybe
|
||||||
Primary key
|
Primary key
|
||||||
StudyTerms
|
StudyTerms -- Studiengang
|
||||||
key Int
|
key Int
|
||||||
shorthand Text Maybe
|
shorthand Text Maybe
|
||||||
name Text Maybe
|
name Text Maybe
|
||||||
|
|||||||
@ -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 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 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 :: (UserTableExpr -> a) -> (UserTableExpr -> a)
|
||||||
forceUserTableType = id
|
forceUserTableType = id
|
||||||
@ -649,10 +649,10 @@ instance HasUser UserTableData where
|
|||||||
hasUser = _dbrOutput . _1 . _entityVal
|
hasUser = _dbrOutput . _1 . _entityVal
|
||||||
|
|
||||||
_userTableRegistration :: Lens' UserTableData UTCTime
|
_userTableRegistration :: Lens' UserTableData UTCTime
|
||||||
_userTableRegistration = _dbrOutput . _2 . _unValue
|
_userTableRegistration = _dbrOutput . _2
|
||||||
|
|
||||||
_userTableNote :: Lens' UserTableData (Maybe CourseUserNoteId)
|
_userTableNote :: Lens' UserTableData (Maybe CourseUserNoteId)
|
||||||
_userTableNote = _dbrOutput . _3 . _unValue
|
_userTableNote = _dbrOutput . _3
|
||||||
|
|
||||||
-- default Where-Clause
|
-- default Where-Clause
|
||||||
courseIs :: CourseId -> UserTableWhere
|
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 :: IsDBTable m c => TermId -> SchoolId -> CourseShorthand -> Colonnade Sortable UserTableData (DBCell m c)
|
||||||
colUserComment tid ssh csh =
|
colUserComment tid ssh csh =
|
||||||
sortable (Just "course-user-note") (i18nCell MsgCourseUserNote)
|
sortable (Just "course-user-note") (i18nCell MsgCourseUserNote)
|
||||||
$ \DBRow{ dbrOutput=(Entity uid _, _, E.Value mbNoteKey) } ->
|
$ \DBRow{ dbrOutput=(Entity uid _, _, mbNoteKey) } ->
|
||||||
maybeEmpty mbNoteKey $ const $
|
maybeEmpty mbNoteKey $ const $
|
||||||
anchorCellM (courseLink <$> encrypt uid) (toWidget $ hasComment True)
|
anchorCellM (courseLink <$> encrypt uid) (toWidget $ hasComment True)
|
||||||
where
|
where
|
||||||
@ -687,7 +687,7 @@ makeCourseUserTable whereClause colChoices psValidator =
|
|||||||
dbtStyle = def
|
dbtStyle = def
|
||||||
dbtSQLQuery = userTableQuery whereClause
|
dbtSQLQuery = userTableQuery whereClause
|
||||||
dbtRowKey ((user `E.InnerJoin` _participant) `E.LeftOuterJoin` _note) = user E.^. UserId
|
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
|
dbtColonnade = colChoices
|
||||||
dbtSorting = Map.fromList [] -- TODO
|
dbtSorting = Map.fromList [] -- TODO
|
||||||
dbtFilter = Map.fromList [] -- TODO
|
dbtFilter = Map.fromList [] -- TODO
|
||||||
|
|||||||
Reference in New Issue
Block a user