fix: sort occurrences in the right order

This commit is contained in:
Wolfgang Witt 2021-03-18 16:23:50 +01:00 committed by Gregor Kleen
parent 30fb1462ab
commit 732df50530

View File

@ -417,7 +417,7 @@ examAutoOccurrence (hash -> seed) rule ExamAutoOccurrenceConfig{..} occurrences
ignoredOccurrences :: ExamAutoOccurrenceIgnoreRooms
-- ^ will always be EAOIRManual with eaoirSorted noting if occurrences were downwards sorted by size
(occurrences'', ignoredOccurrences) = case eaocIgnoreRooms of
EAOIRManual {..} -> ((if eaoirmSorted then sortOn (Down . view _2) else id) $ Map.toList $ Map.withoutKeys occurrences' eaoirmIgnored, eaocIgnoreRooms)
EAOIRManual {..} -> ((if eaoirmSorted then sortOn (view _2) else id) $ Map.toList $ Map.withoutKeys occurrences' eaoirmIgnored, eaocIgnoreRooms)
EAOIRAutomatic -- effect of ticked minimizeRooms Checkbox
| Just largeEnoughs <- fromNullable . filter ((>= Restricted usersCount) . view _2) $ Map.toList occurrences'
-> let pickedLargeEnough = minimumBy (comparing $ view _2) largeEnoughs
@ -467,6 +467,7 @@ examAutoOccurrence (hash -> seed) rule ExamAutoOccurrenceConfig{..} occurrences
where
restrictedLines :: [(lineId, Natural)]
unrestrictedLines :: [lineId]
-- partitionRestricted reverses the order of occurrences
(unrestrictedLines, restrictedLines) = partitionRestricted ([], []) lineLengths
-- reorder so unrestricted lines are at the end and my be left empty