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