chore: filter out pre-filled rooms
This commit is contained in:
parent
eadbbce661
commit
44a52e034f
@ -311,11 +311,14 @@ examAutoOccurrence (hash -> seed) rule ExamAutoOccurrenceConfig{..} occurrences
|
|||||||
|
|
||||||
occurrences' :: Map ExamOccurrenceId Natural
|
occurrences' :: Map ExamOccurrenceId Natural
|
||||||
-- ^ reduce room capacity for every pre-assigned user by 1
|
-- ^ reduce room capacity for every pre-assigned user by 1
|
||||||
occurrences' = foldl' (flip $ Map.adjust predOrZero) occurrences $ Map.mapMaybe snd users
|
occurrences' = foldl' (flip $ Map.update predToPositive) occurrences $ Map.mapMaybe snd users
|
||||||
|
-- FIXME what about capacity-0 in occurrences?
|
||||||
|
-- what if the first word is too big for the first room?
|
||||||
where
|
where
|
||||||
predOrZero :: Natural -> Natural
|
predToPositive :: Natural -> Maybe Natural
|
||||||
predOrZero 0 = 0
|
predToPositive 0 = Nothing
|
||||||
predOrZero n = pred n
|
predToPositive 1 = Nothing
|
||||||
|
predToPositive n = Just $ pred n
|
||||||
|
|
||||||
occurrences'' :: [(ExamOccurrenceId, Natural)]
|
occurrences'' :: [(ExamOccurrenceId, Natural)]
|
||||||
-- ^ Minimise number of occurrences used
|
-- ^ Minimise number of occurrences used
|
||||||
|
|||||||
Reference in New Issue
Block a user