Hotfixes: default sorting of course lists was wrong

This commit is contained in:
SJost 2019-02-22 12:45:35 +01:00
parent 1c99c11fbb
commit d90093bed4
3 changed files with 11 additions and 4 deletions

View File

@ -196,11 +196,10 @@ getCourseListR = do
, colTerm
, colCShort
, maybe mempty (const colRegistered) muid
]
whereClause = const $ E.val True
validator = def
& defaultSorting [SortAscBy "course", SortDescBy "term"]
& defaultSorting [SortDescBy "term",SortAscBy "course"]
coursesTable <- runDB $ makeCourseTable whereClause colonnade validator
defaultLayout $ do
setTitleI MsgCourseListTitle

View File

@ -68,7 +68,7 @@ getTermShowR = do
provideRep $ toJSON . map fst <$> runDB (E.select $ E.from termData)
provideRep $ do
let colonnadeTerms = widgetColonnade $ mconcat
[ sortable Nothing "Kürzel" $ \(Entity tid _, _) -> anchorCell
[ sortable (Just "termid") "Kürzel" $ \(Entity tid _, _) -> anchorCell
(TermCourseListR tid)
[whamlet|#{toPathPiece tid}|]
, sortable (Just "lecture-start") (i18nCell MsgLectureStart) $ \(Entity _ Term{..},_) ->
@ -104,7 +104,8 @@ getTermShowR = do
-- #{termToText termName}
-- |]
-- ]
table <- runDB $ dbTableWidget' def DBTable
let validator = def
table <- runDB $ dbTableWidget' validator DBTable
{ dbtSQLQuery = termData
, dbtRowKey = (E.^. TermId)
, dbtColonnade = colonnadeTerms
@ -122,6 +123,9 @@ getTermShowR = do
, ( "lecture-end"
, SortColumn $ \term -> term E.^. TermLectureEnd
)
, ( "termid"
, SortColumn $ \term -> term E.^. TermId
)
]
, dbtFilter = Map.fromList
[ ( "active"

View File

@ -31,6 +31,10 @@ indicatorCell = writerCell . tell $ Any True
writerCell :: IsDBTable m w => WriterT w m () -> DBCell m w
writerCell act = mempty & cellContents %~ (<* act)
maybeCell :: (IsDBTable m a) => Maybe a -> (a -> DBCell m a) -> DBCell m a
maybeCell =flip foldMap
---------------------
-- Icon cells