chore(term): course list filtered by default to active term
This commit is contained in:
parent
d332c0c11a
commit
28837c41ab
@ -226,7 +226,16 @@ getCourseListR = do
|
||||
]
|
||||
validator = def
|
||||
& defaultSorting [SortDescBy "term",SortAscBy "course"]
|
||||
coursesTable <- runDB $ makeCourseTable colonnade validator
|
||||
now <- liftIO getCurrentTime
|
||||
coursesTable <- runDB $ do
|
||||
activeTs <- selectList [TermActiveFrom <=. now
|
||||
, FilterOr [TermActiveTo >. Just now, TermActiveTo ==. Nothing]
|
||||
, FilterOr [TermActiveFor ==. muid, TermActiveFor ==. Nothing] -- TermActiveFor <-. [Nothing, muid] did not work as intended
|
||||
] [Desc TermActiveTerm]
|
||||
let addTermFilter = if null activeTs
|
||||
then id
|
||||
else defaultFilter $ singletonMap "term" [toPathPiece termActiveTerm | Entity _ TermActive{termActiveTerm} <- activeTs]
|
||||
makeCourseTable colonnade (validator & addTermFilter)
|
||||
defaultLayout $ do
|
||||
setTitleI MsgCourseListTitle
|
||||
$(widgetFile "courses")
|
||||
|
||||
@ -193,7 +193,7 @@ handleAddUserR tid ssh csh tdesc ttyp = do
|
||||
currentRoute <- fromMaybe (error "postCAddUserR called from 404-handler") <$> getCurrentRoute
|
||||
|
||||
(_ , registerConfirmResult) <- runButtonForm FIDCourseRegisterConfirm
|
||||
$logDebugS "***AbortProblem***" $ tshow registerConfirmResult
|
||||
-- $logDebugS "***AbortProblem***" $ tshow registerConfirmResult
|
||||
case registerConfirmResult of
|
||||
Nothing -> return ()
|
||||
(Just BtnCourseRegisterAbort) -> addMessageI Warning MsgAborted
|
||||
|
||||
Loading…
Reference in New Issue
Block a user