Bugfix overloaded Lists in Course

This commit is contained in:
SJost 2018-07-31 16:48:39 +02:00
parent 118192c168
commit fdeec42d36

View File

@ -1,7 +1,6 @@
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE RecordWildCards, NamedFieldPuns, TupleSections #-}
@ -99,7 +98,7 @@ makeCourseTable whereClause colChoices psValidator = do
{ dbtSQLQuery
, dbtColonnade = colChoices
, dbtProj
, dbtSorting =
, dbtSorting = Map.fromList -- OverloadedLists does not work with the templates here
[ ( "course", SortColumn $ \course -> course E.^. CourseName)
, ( "cshort", SortColumn $ \course -> course E.^. CourseShorthand)
, ( "term" , SortColumn $ \course -> course E.^. CourseTerm)
@ -110,7 +109,7 @@ makeCourseTable whereClause colChoices psValidator = do
, ( "registered", SortColumn $ course2Registered muid
)
]
, dbtFilter =
, dbtFilter = Map.fromList -- OverloadedLists does not work with the templates here
[ ( "course", FilterColumn $ \(course :: CourseTableExpr) criterias -> if
| Set.null criterias -> E.val True :: E.SqlExpr (E.Value Bool)
| otherwise -> course E.^. CourseName `E.in_` E.valList (Set.toList criterias)