From 89b36f2d97b5ca9f5447dbc43b9219aa6b98b910 Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Thu, 20 Jan 2022 22:51:55 +0100 Subject: [PATCH] chore(study-modules): remove deprecated study module representation --- .../courses/courses/de-de-formal.msg | 2 -- .../categories/courses/courses/en-eu.msg | 2 -- models/courses.model | 1 - src/Handler/Course/Edit.hs | 6 ---- src/Handler/Course/Show.hs | 1 - src/Handler/Utils/Form.hs | 4 --- src/Model/Types.hs | 1 - src/Model/Types/StudyModules.hs | 29 ------------------- templates/course.hamlet | 14 --------- test/Database/Fill.hs | 9 ------ 10 files changed, 69 deletions(-) delete mode 100644 src/Model/Types/StudyModules.hs diff --git a/messages/uniworx/categories/courses/courses/de-de-formal.msg b/messages/uniworx/categories/courses/courses/de-de-formal.msg index 63d19d345..2e1880882 100644 --- a/messages/uniworx/categories/courses/courses/de-de-formal.msg +++ b/messages/uniworx/categories/courses/courses/de-de-formal.msg @@ -40,8 +40,6 @@ CourseDescriptionPlaceholder: Bitte mindestens die Modulbeschreibung angeben CourseHomepageExternal: Externe Homepage CourseSemesterMultipleTip: Es stehen für Sie aktuell mehrere Semester zur Auswahl. Stellen Sie bitte sicher, dass Sie das für den Kurs korrekte Semester wählen. CourseHomepageExternalPlaceholder: Optionale externe URL -CourseStudyModules: Assoziierte Module -CourseStudyModulesTip: Komma-separierte Liste an Modulen, für welche Leistungen dieses Kurses verbucht werden können. Bitte nach Möglichkeit die Modulbezeichnung (z.B. WP1) sowie die Studienordnung (z.B. Master Informatik Hauptfach, 08. September 2010) angeben. CourseVisibleFrom: Sichtbar ab CourseVisibleTo: Sichtbar bis CourseVisibleFromTip: Ab diesem Zeitpunkt ist der Kurs für andere Nutzer:innen sichtbar. Ohne Datum ist der Kurs nie für andere Nutzer:innen sichtbar. Dozierende, Assistent:innen, Tutor:innen, Korrektor:innen, angemeldete Teilnehmer:innen sowie Bewerber:innen dieses Kurses sind nicht betroffen. Nimmt der Kurs an einer Zentralanmeldung teil wird die Kurssichtbarkeit während der Bewerbungsphase forciert. diff --git a/messages/uniworx/categories/courses/courses/en-eu.msg b/messages/uniworx/categories/courses/courses/en-eu.msg index def2c1c51..c4eda4efc 100644 --- a/messages/uniworx/categories/courses/courses/en-eu.msg +++ b/messages/uniworx/categories/courses/courses/en-eu.msg @@ -39,8 +39,6 @@ CourseSemester: Semester CourseDescriptionPlaceholder: Please include the module description CourseHomepageExternalPlaceholder: Optional external URL CourseHomepageExternal: External homepage -CourseStudyModules: Associated study modules -CourseStudyModulesTip: Comma-separated list of study modules for which results of this course may be credited. If possible, please specify the module identifier (e.g. WP1) as well as the respective study regulations (e.g. Master Computer Science Major, September 8, 2010). CourseSemesterMultipleTip: You are currently allowed to select from among multiple semesters. Please ensure that you select the appropriate semester for your course. CourseVisibleFrom: Visible from CourseVisibleTo: Visible to diff --git a/models/courses.model b/models/courses.model index 38923b9c0..6ea7c5a40 100644 --- a/models/courses.model +++ b/models/courses.model @@ -11,7 +11,6 @@ Course -- Information about a single course; contained info is always visible shorthand (CI Text) -- practical shorthand of course name, used for identification term TermId -- semester this course is taught school SchoolId - studyModules StudyModules -- study modules this course may be credited for capacity Int Maybe -- number of allowed enrolements, if restricted -- canRegisterNow = maybe False (<= currentTime) registerFrom && maybe True (>= currentTime) registerTo visibleFrom UTCTime Maybe default=now() -- course may be visible from a given day onwards or always hidden diff --git a/src/Handler/Course/Edit.hs b/src/Handler/Course/Edit.hs index 6aaff8054..6ef1789ea 100644 --- a/src/Handler/Course/Edit.hs +++ b/src/Handler/Course/Edit.hs @@ -36,7 +36,6 @@ data CourseForm = CourseForm , cfTerm :: TermId , cfDesc :: Maybe StoredMarkup , cfLink :: Maybe URI - , cfStudyModules :: StudyModules , cfVisFrom :: Maybe UTCTime , cfVisTo :: Maybe UTCTime , cfMatFree :: Bool @@ -74,7 +73,6 @@ courseToForm cEnt@(Entity cid Course{..}) lecs lecInvites alloc = CourseForm , cfShort = courseShorthand , cfTerm = courseTerm , cfSchool = courseSchool - , cfStudyModules = courseStudyModules , cfCapacity = courseCapacity , cfSecret = courseRegisterSecret , cfMatFree = courseMaterialFree @@ -297,8 +295,6 @@ makeCourseForm miButtonAction template = identifyForm FIDcourse . validateFormDB (cfDesc <$> template) <*> aopt urlField (fslpI MsgCourseHomepageExternal (mr MsgCourseHomepageExternalPlaceholder)) (cfLink <$> template) - <*> apopt studyModulesSimpleField (fslI MsgCourseStudyModules & setTooltip MsgCourseStudyModulesTip) - (cfStudyModules <$> template) <*> aopt utcTimeField (fslpI MsgCourseVisibleFrom (mr MsgCourseDate) & setTooltip MsgCourseVisibleFromTip) (deepAlt (cfVisFrom <$> template) newVisFrom) <*> aopt utcTimeField (fslpI MsgCourseVisibleTo (mr MsgCourseDate) @@ -498,7 +494,6 @@ courseEditHandler miButtonAction mbCourseForm = do , courseShorthand = cfShort , courseTerm = cfTerm , courseSchool = cfSchool - , courseStudyModules = cfStudyModules , courseCapacity = cfCapacity , courseRegisterSecret = cfSecret , courseMaterialFree = cfMatFree @@ -550,7 +545,6 @@ courseEditHandler miButtonAction mbCourseForm = do , courseShorthand = cfShort , courseTerm = cfTerm -- dangerous , courseSchool = cfSchool - , courseStudyModules = cfStudyModules , courseCapacity = cfCapacity , courseRegisterSecret = cfSecret , courseMaterialFree = cfMatFree diff --git a/src/Handler/Course/Show.hs b/src/Handler/Course/Show.hs index a488e0d7b..1f25a0b29 100644 --- a/src/Handler/Course/Show.hs +++ b/src/Handler/Course/Show.hs @@ -14,7 +14,6 @@ import Handler.Utils.Tutorial import qualified Data.CaseInsensitive as CI import qualified Data.Map as Map -import qualified Data.Set as Set import qualified Database.Esqueleto.Legacy as E import qualified Database.Esqueleto.Utils as E diff --git a/src/Handler/Utils/Form.hs b/src/Handler/Utils/Form.hs index 0c7e53638..34a372192 100644 --- a/src/Handler/Utils/Form.hs +++ b/src/Handler/Utils/Form.hs @@ -2529,7 +2529,3 @@ i18nFieldW :: forall a ident handler. -> Maybe (Maybe (I18n a)) -> WForm handler (FormResult (Maybe (I18n a))) i18nFieldW strField onlyAppLanguages miButtonAction miIdent fSettings fRequired mPrev' = aFormToWForm $ i18nFieldA strField onlyAppLanguages miButtonAction miIdent fSettings fRequired mPrev' - - -studyModulesSimpleField :: Field Handler StudyModules -studyModulesSimpleField = convertField (Set.fromList . map (StudyModuleFreeModule . CI.mk) . filter (not . Text.null) . map Text.strip . Text.splitOn ",") (intercalate ", " . map (CI.original . stdModFreeModule) . Set.toList) textField diff --git a/src/Model/Types.hs b/src/Model/Types.hs index 92963e789..5b5562675 100644 --- a/src/Model/Types.hs +++ b/src/Model/Types.hs @@ -23,4 +23,3 @@ import Model.Types.Markup as Types import Model.Types.Room as Types import Model.Types.Csv as Types import Model.Types.Upload as Types -import Model.Types.StudyModules as Types diff --git a/src/Model/Types/StudyModules.hs b/src/Model/Types/StudyModules.hs deleted file mode 100644 index d016b9bb4..000000000 --- a/src/Model/Types/StudyModules.hs +++ /dev/null @@ -1,29 +0,0 @@ -module Model.Types.StudyModules - where - -import Import.NoModel - - -data StudyModule - = StudyModuleModule -- full (i.e. unambiguous) study module specification - { stdModRegulation :: CI Text -- TODO: Reference StudyDegree and StudyTerms instead? - , stdModRegVersion :: UTCTime - , stdModModule :: CI Text - } - | StudyModuleFreeModule -- allows for arbitrary module specifications - { stdModFreeModule :: CI Text - } - deriving (Eq, Ord, Read, Show, Generic, Typeable) - deriving anyclass (NFData) - -deriveJSON defaultOptions - { fieldLabelModifier = camelToPathPiece' 2 - , constructorTagModifier = camelToPathPiece' 2 - } ''StudyModule - -derivePersistFieldJSON ''StudyModule - -instance Binary StudyModule - - -type StudyModules = Set StudyModule diff --git a/templates/course.hamlet b/templates/course.hamlet index 9dcd69070..de6452829 100644 --- a/templates/course.hamlet +++ b/templates/course.hamlet @@ -69,20 +69,6 @@ $# #{summary}
#{descr} - $if not (Set.null (courseStudyModules course)) -
_{MsgCourseStudyModules} -
-
    - $forall studyModule <- Set.toList (courseStudyModules course) -
  • - $case studyModule - $of StudyModuleModule{..} - #{CI.original stdModRegulation} # - (^{formatTimeW SelFormatDate stdModRegVersion}): # - #{CI.original stdModModule} - $of StudyModuleFreeModule{..} - #{CI.original stdModFreeModule} -
    _{MsgTableCourseSchool}
    #{schoolName} diff --git a/test/Database/Fill.hs b/test/Database/Fill.hs index 1f53dcdf5..b57095456 100644 --- a/test/Database/Fill.hs +++ b/test/Database/Fill.hs @@ -660,7 +660,6 @@ fillDb = do , courseShorthand = "FFP" , courseTerm = TermKey $ seasonTerm True Summer , courseSchool = ifi - , courseStudyModules = Set.fromList $ (StudyModuleFreeModule . CI.mk) <$> [ "Bachelor Informatik HF P16", "Bachelor (Medien-)Informatik HF P17", "Bachelor Medieninformatik HF P18", "Master Informatik HF WP8/WP9", "Master Medieninformatik HF P2/P6", "Master Informatik NF WP20" ] , courseCapacity = Just 20 , courseVisibleFrom = Just now , courseVisibleTo = Nothing @@ -814,7 +813,6 @@ fillDb = do , courseShorthand = "EIP" , courseTerm = TermKey $ seasonTerm False Winter , courseSchool = ifi - , courseStudyModules = Set.fromList $ (StudyModuleFreeModule . CI.mk) <$> [ "Bachelor (Medien-)Informatik HF P1" ] , courseCapacity = Just 20 , courseVisibleFrom = Just now , courseVisibleTo = Nothing @@ -841,7 +839,6 @@ fillDb = do , courseShorthand = "IXD" , courseTerm = TermKey $ seasonTerm True Summer , courseSchool = ifi - , courseStudyModules = Set.fromList $ (StudyModuleFreeModule . CI.mk) <$> [ "Bachelor Medieninformatik HF WP16.1 + WP16.2" ] , courseCapacity = Just 20 , courseVisibleFrom = Just now , courseVisibleTo = Nothing @@ -869,7 +866,6 @@ fillDb = do , courseTerm = TermKey $ seasonTerm True Winter , courseSchool = ifi , courseCapacity = Just 30 - , courseStudyModules = Set.fromList $ (StudyModuleFreeModule . CI.mk) <$> [ "Bachelor Medieninformatik HF WP16.3" ] , courseVisibleFrom = Just now , courseVisibleTo = Nothing , courseRegisterFrom = Nothing @@ -895,7 +891,6 @@ fillDb = do , courseShorthand = "ProMo" , courseTerm = TermKey $ seasonTerm True Summer , courseSchool = ifi - , courseStudyModules = Set.fromList $ (StudyModuleFreeModule . CI.mk) <$> [ "Bachelor Informatik HF P4", "Bachelor Medieninformatik HF P2", "Bachelor Informatik NF WP1" ] , courseCapacity = Just 50 , courseVisibleFrom = Just now , courseVisibleTo = Nothing @@ -1069,7 +1064,6 @@ fillDb = do , courseShorthand = "DBS" , courseTerm = TermKey $ seasonTerm False Winter , courseSchool = ifi - , courseStudyModules = Set.fromList $ (StudyModuleFreeModule . CI.mk) <$> [ "Bachelor Informatik HF P15", "Bachelor Medieninformatik HF P10", "Bachelor Informatik NF WP10" ] , courseCapacity = Just 50 , courseVisibleFrom = Just now , courseVisibleTo = Nothing @@ -1203,7 +1197,6 @@ fillDb = do , courseShorthand = "BS" , courseTerm = TermKey $ seasonTerm False Winter , courseSchool = ifi - , courseStudyModules = Set.fromList $ (StudyModuleFreeModule . CI.mk) <$> [ "Bachelor Informatik HF P8", "Bachelor Medieninformatik HF P5", "Bachelor Informatik NF WP6" ] , courseCapacity = Just 50 , courseVisibleFrom = Just now , courseVisibleTo = Nothing @@ -1280,7 +1273,6 @@ fillDb = do , courseShorthand = CI.mk csh , courseTerm = TermKey $ seasonTerm False Winter , courseSchool = ifi - , courseStudyModules = Set.empty , courseCapacity = Just 50 , courseVisibleFrom = Just now , courseVisibleTo = Nothing @@ -1343,7 +1335,6 @@ fillDb = do , courseShorthand = CI.mk csh , courseTerm = TermKey $ seasonTerm False Winter , courseSchool = ifi - , courseStudyModules = Set.empty , courseCapacity = Just cap , courseVisibleFrom = Just now , courseVisibleTo = Nothing