OuterJoin for homeUser startet

This commit is contained in:
SJost 2018-07-03 12:09:52 +02:00
parent c7e02a1c0d
commit aa6f35d9c8

View File

@ -31,13 +31,14 @@ import qualified Database.Esqueleto as E
-- Some constants:
nrSheetDeadlines :: Int64
nrSheetDeadlines = 10
-- nrSheetDeadlines :: Int64
-- nrSheetDeadlines = 10
offSheetDeadlines :: NominalDiffTime
offSheetDeadlines = 15
--nrExamDeadlines = 10
--offExamDeadlines = 15
--nrCourseDeadlines = 10
-- nrCourseDeadlines :: Int64
-- nrCourseDeadlines = 12
--offCourseDeadlines = 15
@ -61,7 +62,7 @@ homeAnonymous = do
E.&&. (course E.^. CourseRegisterFrom E.<=. E.val (Just cTime))
E.&&. ((E.isNothing $ course E.^. CourseRegisterTo)
E.||. (course E.^. CourseRegisterTo E.>=. E.val (Just cTime)))
E.limit nrSheetDeadlines
-- E.limit nrCourseDeadlines
return course
colonnade :: Colonnade Sortable (DBRow (Entity Course)) (DBCell (WidgetT UniWorX IO) ())
@ -116,9 +117,11 @@ homeUser uid = do
, E.SqlExpr (E.Value Text)
, E.SqlExpr (E.Value Text)
, E.SqlExpr (E.Value UTCTime))
tableData (participant `E.InnerJoin` course `E.InnerJoin` sheet) = do
E.on $ course E.^. CourseId E.==. sheet E.^. SheetCourse
E.on $ course E.^. CourseId E.==. participant E.^. CourseParticipantCourse
tableData ((participant `E.InnerJoin` course `E.InnerJoin` sheet) `E.LeftOuterJoin` (submission `E.LeftOuterJoin` sedit)) = do
E.on $ submission E.^. SubmissionId E.==. sedit E.^. SubmissionId
E.on $ sheet E.^. SheetId E.==. sedit E.^. SubmissionSheet
E.on $ course E.^. CourseId E.==. sheet E.^. SheetCourse
E.on $ course E.^. CourseId E.==. participant E.^. CourseParticipantCourse
E.where_ $ participant E.^. CourseParticipantUser E.==. E.val uid
E.&&. sheet E.^. SheetActiveTo E.<=. E.val fTime
E.&&. sheet E.^. SheetActiveTo E.>=. E.val cTime
@ -128,6 +131,8 @@ homeUser uid = do
, course E.^. CourseShorthand
, sheet E.^. SheetName
, sheet E.^. SheetActiveTo
, submission E.^. SubmissionId
, sedit
)
colonnade :: Colonnade Sortable (DBRow (E.Value (Key Term), E.Value Text, E.Value Text, E.Value UTCTime)) (DBCell (WidgetT UniWorX IO) ())