fix: correctly report NoUsers for ExamRoomRandom

preselection was ignored for the check so far
This commit is contained in:
Wolfgang Witt 2021-03-24 13:52:39 +01:00 committed by Gregor Kleen
parent e00a2b074b
commit 16cbc78878
2 changed files with 4 additions and 4 deletions

View File

@ -1,5 +1,4 @@
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# OPTIONS_GHC -Wwarn #-}
module Handler.Exam.AutoOccurrence
( examAutoOccurrenceCalculateWidget
@ -199,7 +198,6 @@ postEAutoOccurrenceR tid ssh csh examn = do
let calculateRes' = asum $ calculateRes : nudgeRes ^.. folded . _1 . _1 ++ ignoreRes ^.. folded . _1 . _1
calcResult <- formResultMaybe calculateRes' $ \ExamAutoOccurrenceCalculateForm{..} -> do
let autoOccurrenceResult = examAutoOccurrence eId examOccurrenceRule eaofConfig occurrences' participants'
(eaofMapping, eaofAssignment, eaofSuccess) <- case autoOccurrenceResult of

View File

@ -407,8 +407,10 @@ examAutoOccurrence (hash -> seed) rule ExamAutoOccurrenceConfig{..} occurrences
]
takeEnd n chars = drop (length chars - n) chars
in Map.mapKeysWith Set.union (takeEnd . F.minimum . Set.map length $ Map.keysSet matrUsers) matrUsers
_ | null users-> Map.empty
| otherwise -> Map.singleton [] $ Map.keysSet users
_ | null unassignedUsers -> Map.empty
| otherwise -> Map.singleton [] $ Map.keysSet unassignedUsers
where
unassignedUsers = Map.filter (has $ _2 . _Nothing) users
occurrencesSize :: ExamOccurrenceCapacity
occurrencesSize = foldMap' (view _2) occurrences''