chore: check for no users first

This commit is contained in:
Wolfgang Witt 2021-03-01 17:25:50 +01:00 committed by Wolfgang Witt
parent 5dc37a07c1
commit 767090ded1

View File

@ -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