examplary course-shorthand-filter in terms-list

This commit is contained in:
Gregor Kleen 2018-06-21 11:18:01 +02:00
parent 710ace42bf
commit 0a433f06a5

View File

@ -87,6 +87,13 @@ getTermShowR = do
, dbtFilter = [ ( "active"
, FilterColumn $ \term -> (term E.^. TermActive :: E.SqlExpr (E.Value Bool))
)
, ( "course"
, FilterColumn $ \term csh -> case csh of -- FilterColumn-Lambdas are
[] -> E.val True :: E.SqlExpr (E.Value Bool)
cshs -> E.exists . E.from $ \course -> do
E.where_ $ course E.^. CourseTerm E.==. term E.^. TermId
E.&&. course E.^. CourseShorthand `E.in_` E.valList cshs
)
]
, dbtAttrs = tableDefault
, dbtIdent = "terms" :: Text