fix: sort occurrences in the right order
This commit is contained in:
parent
30fb1462ab
commit
732df50530
@ -417,7 +417,7 @@ examAutoOccurrence (hash -> seed) rule ExamAutoOccurrenceConfig{..} occurrences
|
|||||||
ignoredOccurrences :: ExamAutoOccurrenceIgnoreRooms
|
ignoredOccurrences :: ExamAutoOccurrenceIgnoreRooms
|
||||||
-- ^ will always be EAOIRManual with eaoirSorted noting if occurrences were downwards sorted by size
|
-- ^ will always be EAOIRManual with eaoirSorted noting if occurrences were downwards sorted by size
|
||||||
(occurrences'', ignoredOccurrences) = case eaocIgnoreRooms of
|
(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
|
EAOIRAutomatic -- effect of ticked minimizeRooms Checkbox
|
||||||
| Just largeEnoughs <- fromNullable . filter ((>= Restricted usersCount) . view _2) $ Map.toList occurrences'
|
| Just largeEnoughs <- fromNullable . filter ((>= Restricted usersCount) . view _2) $ Map.toList occurrences'
|
||||||
-> let pickedLargeEnough = minimumBy (comparing $ view _2) largeEnoughs
|
-> let pickedLargeEnough = minimumBy (comparing $ view _2) largeEnoughs
|
||||||
@ -467,6 +467,7 @@ examAutoOccurrence (hash -> seed) rule ExamAutoOccurrenceConfig{..} occurrences
|
|||||||
where
|
where
|
||||||
restrictedLines :: [(lineId, Natural)]
|
restrictedLines :: [(lineId, Natural)]
|
||||||
unrestrictedLines :: [lineId]
|
unrestrictedLines :: [lineId]
|
||||||
|
-- partitionRestricted reverses the order of occurrences
|
||||||
(unrestrictedLines, restrictedLines) = partitionRestricted ([], []) lineLengths
|
(unrestrictedLines, restrictedLines) = partitionRestricted ([], []) lineLengths
|
||||||
|
|
||||||
-- reorder so unrestricted lines are at the end and my be left empty
|
-- reorder so unrestricted lines are at the end and my be left empty
|
||||||
|
|||||||
Reference in New Issue
Block a user