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/Utils/ExternalExam.hs
2020-08-11 21:18:59 +02:00

16 lines
496 B
Haskell

module Handler.Utils.ExternalExam
( fetchExternalExam
) where
import Import
fetchExternalExam :: MonadHandler m => TermId -> SchoolId -> CourseName -> ExamName -> ReaderT SqlBackend m (Entity ExternalExam)
fetchExternalExam tid ssh coursen examn =
let cachId = encodeUtf8 $ tshow (tid, ssh, coursen, examn)
in cachedBy cachId $ do
mExtEx <- getBy $ UniqueExternalExam tid ssh coursen examn
case mExtEx of
Just extEx -> return extEx
_ -> notFound