From 767090ded11d6f5b1610591db1b6448e871477da Mon Sep 17 00:00:00 2001 From: Wolfgang Witt Date: Mon, 1 Mar 2021 17:25:50 +0100 Subject: [PATCH] chore: check for no users first --- src/Handler/Utils/Exam.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Handler/Utils/Exam.hs b/src/Handler/Utils/Exam.hs index 863cc98ac..150416cd7 100644 --- a/src/Handler/Utils/Exam.hs +++ b/src/Handler/Utils/Exam.hs @@ -278,11 +278,11 @@ examAutoOccurrence :: forall seed. -> Map UserId (User, Maybe ExamOccurrenceId) -> Either ExamAutoOccurrenceException (ExamOccurrenceMapping ExamOccurrenceId, Map UserId (Maybe ExamOccurrenceId)) examAutoOccurrence (hash -> seed) rule ExamAutoOccurrenceConfig{..} occurrences users + | Map.null users' + = Left ExamAutoOccurrenceExceptionNoUsers | sum occurrences' < usersCount || sum occurrences' <= 0 = Left ExamAutoOccurrenceExceptionNotEnoughSpace - | Map.null users' - = Left ExamAutoOccurrenceExceptionNoUsers | otherwise = case rule of ExamRoomRandom