chore: add test courses

This commit is contained in:
Gregor Kleen 2020-03-03 17:15:29 +01:00
parent f0f046f4b6
commit 3e3c1334ca

View File

@ -974,3 +974,33 @@ fillDb = do
forM_ grpUsers $ void . insert . flip SubmissionUser sub
void . insert $ SubmissionEdit pUid now sub
_other -> return ()
forM_ ([1..100] :: [Int]) $ \n -> do
csh <- pack . take 3 <$> getRandomRs ('A', 'Z')
cid <- insert' Course
{ courseName = CI.mk [st|Test Kurs #{n} (#{csh})|]
, courseDescription = Nothing
, courseLinkExternal = Nothing
, courseShorthand = CI.mk csh
, courseTerm = TermKey $ seasonTerm False Winter
, courseSchool = ifi
, courseCapacity = Just 50
, courseRegisterFrom = Nothing
, courseRegisterTo = Nothing
, courseDeregisterUntil = Nothing
, courseRegisterSecret = Nothing
, courseMaterialFree = True
, courseApplicationsRequired = False
, courseApplicationsInstructions = Nothing
, courseApplicationsText = False
, courseApplicationsFiles = NoUpload
, courseApplicationsRatingsVisible = False
}
insert_ $ CourseEdit gkleen now cid
void . insert' $ Lecturer gkleen cid CourseLecturer
participants <- getRandomR (0, 50)
manyUsers' <- shuffleM manyUsers
forM_ (take participants manyUsers') $ \uid ->
void . insert $ CourseParticipant cid uid now Nothing Nothing