This repository has been archived on 2024-10-24. You can view files and clone it, but cannot push or open issues or pull requests.
fradrive-old/src/Handler/Sheet/Current.hs
Gregor Kleen c68a01d7ae refactor: split foundation & llvm
BREAKING CHANGE: split foundation
2020-08-14 17:02:14 +02:00

29 lines
942 B
Haskell

module Handler.Sheet.Current
( getSheetCurrentR
, getSheetOldUnassignedR
) where
import Import
import Handler.Utils
import Utils.Sheet
getSheetCurrentR :: TermId -> SchoolId -> CourseShorthand -> Handler Void
getSheetCurrentR tid ssh csh = do
mbShn <- runDB $ sheetCurrent tid ssh csh
case mbShn of
Just shn -> redirectAccess $ CSheetR tid ssh csh shn SShowR
Nothing -> do -- no current sheet exists
addMessageI Error MsgSheetNoCurrent
redirect $ CourseR tid ssh csh SheetListR
getSheetOldUnassignedR :: TermId -> SchoolId -> CourseShorthand -> Handler Void
getSheetOldUnassignedR tid ssh csh = do
mbShn <- runDB $ sheetOldUnassigned tid ssh csh
case mbShn of
Just shn -> redirectAccess $ CSheetR tid ssh csh shn SSubsR
Nothing -> do -- no unassigned submissions in any inactive sheet
addMessageI Error MsgSheetNoOldUnassigned
redirect $ CourseR tid ssh csh SheetListR