From 4a731eca4e69b5ee080f229a602e76f5ae165c64 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 14 Oct 2020 08:28:19 +0200 Subject: [PATCH] fix(allocations): work around yesod weirdness wrt "none" --- messages/uniworx/de-de-formal.msg | 2 +- messages/uniworx/en-eu.msg | 2 +- src/Handler/Allocation/Compute.hs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/messages/uniworx/de-de-formal.msg b/messages/uniworx/de-de-formal.msg index aba2c9510..3d52ca2b6 100644 --- a/messages/uniworx/de-de-formal.msg +++ b/messages/uniworx/de-de-formal.msg @@ -2761,7 +2761,7 @@ AllocationUsersMissingPrioritiesTip: Es muss sichergestellt sein, dass keine Tei AllocationUsersMissingPrioritiesOk: Es wurde sichergestellt, dass es für jeden der genannten Benutzer einen zulässigen Grund gibt, warum dieser nicht an der Zentralanmeldung teilnehmen sollte. AllocationRestrictCourses: Kurse einschränken AllocationRestrictCoursesTip: Sollen nur Plätze für eine Teilmenge von Kursen zugewiesen werden? So können u.A. Nachrücker verteilt werden. Diese Funktionalität sollte nur verwendet werden, wenn manche Kurse aus zulässigen Gründen ausgeschlossen werden müssen; z.B. weil ein Seminar bereits ein Treffen zur Organisation hatte und nun keine weiteren Teilnehmer mehr akzeptieren kann. -AllocationCourseRestrictionNone: Nicht einschränken +AllocationCourseRestrictionDontRestrict: Nicht einschränken AllocationCourseRestrictionSubstitutes: Kurse, die aktuell Nachrücker azkeptieren AllocationCourseRestrictionCustom: Benutzerdefiniert AllocationRestrictCoursesSelection: Kurse diff --git a/messages/uniworx/en-eu.msg b/messages/uniworx/en-eu.msg index 6b9f93c16..41d77282b 100644 --- a/messages/uniworx/en-eu.msg +++ b/messages/uniworx/en-eu.msg @@ -2762,7 +2762,7 @@ AllocationUsersMissingPrioritiesTip: Care must be taken, that no participant is AllocationUsersMissingPrioritiesOk: It was ensured, that all participants mentioned above, are excluded from the allocation on valid grounds. AllocationRestrictCourses: Restrict courses AllocationRestrictCoursesTip: Should places be assigned only in a subset of courses? This functionality can be used to make alternate placements in the case that some participants withdraw from their assigned courses. This functionality should only be used to exclude courses on valid grounds. E.g. if a seminar already had a planning meeting and is thus unable to accept new participants. -AllocationCourseRestrictionNone: Don't restrict +AllocationCourseRestrictionDontRestrict: Don't restrict AllocationCourseRestrictionSubstitutes: Courses which currently allow substitute registrations AllocationCourseRestrictionCustom: Custom AllocationRestrictCoursesSelection: Courses diff --git a/src/Handler/Allocation/Compute.hs b/src/Handler/Allocation/Compute.hs index d1d5a18ef..bf13fa05a 100644 --- a/src/Handler/Allocation/Compute.hs +++ b/src/Handler/Allocation/Compute.hs @@ -72,7 +72,7 @@ missingPriorities aId = wFormToAForm $ do data AllocationCourseRestrictionMode - = AllocationCourseRestrictionNone + = AllocationCourseRestrictionDontRestrict | AllocationCourseRestrictionSubstitutes | AllocationCourseRestrictionCustom deriving (Eq, Ord, Read, Show, Enum, Bounded, Generic, Typeable) @@ -81,10 +81,10 @@ nullaryPathPiece ''AllocationCourseRestrictionMode $ camelToPathPiece' 3 embedRenderMessage ''UniWorX ''AllocationCourseRestrictionMode id restrictCourses :: (MonadHandler m, HandlerSite m ~ UniWorX) => AllocationId -> AForm m (Maybe (Set CourseId)) -restrictCourses aId = hoistAForm liftHandler $ multiActionA restrictOpts (fslI MsgAllocationRestrictCourses & setTooltip MsgAllocationRestrictCoursesTip) (Just AllocationCourseRestrictionNone) +restrictCourses aId = hoistAForm liftHandler $ multiActionA restrictOpts (fslI MsgAllocationRestrictCourses & setTooltip MsgAllocationRestrictCoursesTip) (Just AllocationCourseRestrictionDontRestrict) where restrictOpts = mapF $ \case - AllocationCourseRestrictionNone -> pure Nothing + AllocationCourseRestrictionDontRestrict -> pure Nothing AllocationCourseRestrictionSubstitutes -> wFormToAForm $ do now <- liftIO getCurrentTime allocCourses <- fmap (setOf $ folded . _Value) . liftHandler . runDB . E.select . E.from $ \allocationCourse -> do