fradrive/src/Handler/Course.hs

58 lines
2.2 KiB
Haskell

{-# OPTIONS_GHC -Wwarn #-}
module Handler.Course
( module Handler.Course
) where
import Import
import qualified Database.Esqueleto as E
import qualified Database.Esqueleto.Utils as E
import Handler.Course.Communication as Handler.Course
import Handler.Course.Delete as Handler.Course
import Handler.Course.Edit as Handler.Course
import Handler.Course.LecturerInvite as Handler.Course
import Handler.Course.List as Handler.Course
import Handler.Course.ParticipantInvite as Handler.Course
import Handler.Course.Register as Handler.Course
import Handler.Course.Show as Handler.Course
import Handler.Course.User as Handler.Course
import Handler.Course.Users as Handler.Course
import Handler.Course.Application as Handler.Course
import Handler.ExamOffice.Course as Handler.Course
import Handler.Course.News as Handler.Course
import Handler.Course.Events as Handler.Course
import Handler.Sheet.PersonalisedFiles as Handler.Course (getCPersonalFilesR)
getCHiWisR :: TermId -> SchoolId -> CourseShorthand -> Handler Html
getCHiWisR = error "CHiWisR: Not implemented"
getCNotesR, postCNotesR :: TermId -> SchoolId -> CourseShorthand -> Handler Html
-- NOTE: The route getNotesR is abused for correctorORlecturer access rights!
-- PROBLEM: Correctors usually don't know Participants by name (anonymous), maybe notes are not shared?
-- If they are shared, adjust MsgCourseUserNoteTooltip
getCNotesR = postCNotesR
postCNotesR _ _ _ = defaultLayout [whamlet|You have corrector access to this course.|]
postCFavouriteR :: TermId -> SchoolId -> CourseShorthand -> Handler ()
postCFavouriteR tid ssh csh = do
muid <- maybeAuthPair
-- TODO swap FavouriteReason here
runDB $ do
-- Nothing means blacklist
-- should never return FavouriteCurrent
currentReason <- storedFavouriteReason tid ssh csh muid
-- TODO change stored reason in DB
-- TODO participants can't remove favourite (only toggle between automatic/manual)?
pure ()
-- TODO participants can't remove favourite?
liftIO $ do
putStrLn "\nswapping FavouriteReason"
print (tid, ssh, csh)
-- show course page again
void $ redirect $ CourseR tid ssh csh CShowR
-- TODO Route for Icon to toggle manual Favorite