From e33ca48227442fcd772177783dd0ae2517f3af51 Mon Sep 17 00:00:00 2001 From: Steffen Jost Date: Fri, 24 Sep 2021 19:38:46 +0200 Subject: [PATCH] chore(testdata): create f course for avn-a --- test/Database/Fill.hs | 82 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 79 insertions(+), 3 deletions(-) diff --git a/test/Database/Fill.hs b/test/Database/Fill.hs index df48e0d35..10ded4d57 100644 --- a/test/Database/Fill.hs +++ b/test/Database/Fill.hs @@ -155,7 +155,7 @@ fillDb = do , userTitle = Just "Dr." , userMaxFavourites = 14 , userMaxFavouriteTerms = 4 - , userTheme = ThemeMossGreen + , userTheme = userDefaultTheme , userDateTimeFormat = userDefaultDateTimeFormat , userDateFormat = userDefaultDateFormat , userTimeFormat = userDefaultTimeFormat @@ -353,7 +353,7 @@ fillDb = do matrikel <- toMatrikel <$> getRandomRs (0 :: Int, 9 :: Int) manyUsers <- insertMany . getZipList $ manyUser <$> ZipList ((,,) <$> firstNames <*> middlenames <*> surnames) <*> ZipList matrikel - forM_ [prevPrevTerm, prevTerm, currentTerm, nextTerm, succ nextTerm] $ \tid -> do + forM_ [(pred $ pred prevPrevTerm)..(succ $ succ $ succ $ succ nextTerm)] $ \tid -> do let term = Term { termName = tid , termStart = guessDay tid TermDayStart , termEnd = guessDay tid TermDayEnd @@ -391,6 +391,8 @@ fillDb = do } ifi <- insert' $ School "Institut für Informatik" "IfI" (Just $ 14 * nominalDay) (Just $ 10 * nominalDay) True (ExamModeDNF predDNFFalse) (ExamCloseOnFinished True) SchoolAuthorshipStatementModeOptional (Just ifiAuthorshipStatement) True SchoolAuthorshipStatementModeRequired (Just ifiAuthorshipStatement) False mi <- insert' $ School "Institut für Mathematik" "MI" Nothing Nothing False (ExamModeDNF predDNFFalse) (ExamCloseOnFinished False) SchoolAuthorshipStatementModeNone Nothing True SchoolAuthorshipStatementModeOptional Nothing True + avn <- insert' $ School "Fahrschule" "AVN-A" Nothing Nothing False (ExamModeDNF predDNFFalse) (ExamCloseOnFinished False) SchoolAuthorshipStatementModeNone Nothing True SchoolAuthorshipStatementModeOptional Nothing True + void . insert' $ UserFunction jost avn SchoolAdmin void . insert' $ UserFunction gkleen ifi SchoolAdmin void . insert' $ UserFunction gkleen mi SchoolAdmin void . insert' $ UserFunction fhamann ifi SchoolAdmin @@ -405,10 +407,12 @@ fillDb = do void . insert' $ UserFunction gkleen ifi SchoolAllocation void . insert' $ UserFunction sbarth ifi SchoolLecturer void . insert' $ UserFunction sbarth ifi SchoolExamOffice - for_ [gkleen, fhamann, jost, maxMuster, svaupel] $ \uid -> + for_ [gkleen, fhamann, maxMuster, svaupel] $ \uid -> void . insert' $ UserSchool uid ifi False for_ [gkleen, tinaTester] $ \uid -> void . insert' $ UserSchool uid mi False + for_ [jost] $ \uid -> + void . insert' $ UserSchool uid avn False let sdBsc = StudyDegreeKey' 82 sdMst = StudyDegreeKey' 88 @@ -576,6 +580,78 @@ fillDb = do True Nothing + + -- Fahrschule F + fdf <- insert' Course + { courseName = "F - Vorfeldführerschein" + , courseDescription = Just $ htmlToStoredMarkup [shamlet| +

+ Berechtigung zum Führen eines Fahrzeuges auf den Fahrstrassen des Vorfeldes. +

+

Benötigte Unterlagen +
    +
  • Sehtest + (Bitte vorab hochladen!) +
  • Regulärer Führerschein + |] + , courseLinkExternal = Nothing + , courseShorthand = "F" + , courseTerm = TermKey $ currentTerm + , courseSchool = avn + , courseCapacity = Nothing + , courseVisibleFrom = Just now + , courseVisibleTo = Nothing + , courseRegisterFrom = Just $ termTime True (season currentTerm) (-2) False Monday toMidnight + , courseRegisterTo = Just $ termTime True (season currentTerm) 0 True Saturday beforeMidnight + , courseDeregisterUntil = Nothing + , courseRegisterSecret = Nothing + , courseMaterialFree = True + , courseApplicationsRequired = False + , courseApplicationsInstructions = Nothing + , courseApplicationsText = False + , courseApplicationsFiles = NoUpload + , courseApplicationsRatingsVisible = False + , courseDeregisterNoShow = True + } + insert_ $ CourseEdit jost now fdf + + forM_ [(Monday)..Thursday] $ \td -> do + forM_ [(1::Int)..4] $ \tw -> do + tut1 <- insert Tutorial + { tutorialName = CI.mk $ Text.pack $ "KW" ++ (show tw) ++ (take 3 $ show td) + , tutorialCourse = fdf + , tutorialType = "Schulung" + , tutorialCapacity = Just 16 + , tutorialRoom = Just $ case tw of + 1 -> "A380" + 2 -> "B747" + 3 -> "A320" + _ -> "CRJ9" + , tutorialRoomHidden = False + , tutorialTime = Occurrences + { occurrencesScheduled = Set.empty + , occurrencesExceptions = Set.fromList + [ ExceptOccur + { exceptDay = utctDay $ termTime True (season currentTerm) (toRational $ tw - 1) False td (toMorning) + , exceptStart = TimeOfDay 8 30 0 + , exceptEnd = TimeOfDay 16 0 0 + } + , ExceptOccur + { exceptDay = utctDay $ termTime True (season currentTerm) (toRational $ tw - 1) False (succ td) (toMorning) + , exceptStart = TimeOfDay 9 0 0 + , exceptEnd = TimeOfDay 16 0 0 + } + ] + } + , tutorialRegGroup = Just "schulung" + , tutorialRegisterFrom = Just $ termTime True (season currentTerm) (toRational $ tw - 9) False td (toMorning) + , tutorialRegisterTo = Just $ termTime True (season currentTerm) (toRational $ tw - 2) False td (toMorning) + , tutorialDeregisterUntil = Nothing + , tutorialLastChanged = now + , tutorialTutorControlled = True + } + void . insert $ Tutor tut1 jost + -- FFP let nbrs :: [Int] nbrs = [1,2,3,27,7,1]