Minor clean up

This commit is contained in:
SJost 2019-02-27 12:14:06 +01:00
parent 2ce657fe5e
commit f20f2cb005
2 changed files with 8 additions and 8 deletions

View File

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

View File

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