From 732df5053033c3533f52850cc6220dd06a7e3500 Mon Sep 17 00:00:00 2001 From: Wolfgang Witt Date: Thu, 18 Mar 2021 16:23:50 +0100 Subject: [PATCH] fix: sort occurrences in the right order --- src/Handler/Utils/Exam.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Handler/Utils/Exam.hs b/src/Handler/Utils/Exam.hs index 9a63a6ac3..a3cf09c7f 100644 --- a/src/Handler/Utils/Exam.hs +++ b/src/Handler/Utils/Exam.hs @@ -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