fix: correctly handle original minimizeRooms-flag
This commit is contained in:
parent
732df50530
commit
d5bd5042ad
@ -93,11 +93,12 @@ examAutoOccurrenceIgnoreRoomsForm occId protoForm html = do
|
||||
let protoForm' = fromMaybe def $ protoForm <|> oldDataRes
|
||||
genForm btn = protoForm' & _eaofConfig . _eaocIgnoreRooms %~ action
|
||||
where
|
||||
action EAOIRAutomatic = EAOIRManual {eaoirmIgnored=Set.empty, eaoirmSorted=True}
|
||||
action ir@EAOIRManual {eaoirmIgnored, eaoirmSorted} = case btn of
|
||||
BtnExamAutoOccurrenceIgnore -> EAOIRManual {eaoirmIgnored=Set.insert occId eaoirmIgnored, eaoirmSorted}
|
||||
BtnExamAutoOccurrenceReconsider -> EAOIRManual {eaoirmIgnored=Set.delete occId eaoirmIgnored, eaoirmSorted}
|
||||
_other -> ir
|
||||
action EAOIRAutomatic = EAOIRManual {eaoirmIgnored=setAction occId Set.empty, eaoirmSorted=True}
|
||||
action EAOIRManual {eaoirmIgnored, eaoirmSorted} = EAOIRManual {eaoirmIgnored=setAction occId eaoirmIgnored, eaoirmSorted}
|
||||
setAction = case btn of
|
||||
BtnExamAutoOccurrenceIgnore -> Set.insert
|
||||
BtnExamAutoOccurrenceReconsider -> Set.delete
|
||||
_other -> flip const -- i.e. ignore argument
|
||||
res = genForm <$> btnRes
|
||||
oldDataView = fieldView (secretJsonField :: Field Handler _) oldDataId (toPathPiece PostExamAutoOccurrencePrevious) [] (Right . fromMaybe protoForm' $ formResult' res) False
|
||||
return (res, wgt <> oldDataView)
|
||||
@ -149,7 +150,7 @@ postEAutoOccurrenceR tid ssh csh examn = do
|
||||
return (uid, (userRec, examRegistrationOccurrence))
|
||||
occurrences' = Map.fromList $ map (\(Entity eoId ExamOccurrence{..}) -> (eoId, _examOccurrenceCapacityIso # (fromIntegral <$> examOccurrenceCapacity))) occurrences
|
||||
autoOccurrenceResult = examAutoOccurrence eId examOccurrenceRule eaofConfig occurrences' participants'
|
||||
(eaofMapping, eaofAssignment, _ignoredOccurrences) <- case autoOccurrenceResult of
|
||||
(eaofMapping, eaofAssignment, ignoredOccurrences) <- case autoOccurrenceResult of
|
||||
(Left e) -> do
|
||||
addMessageI Error e
|
||||
pure ( ExamOccurrenceMapping {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user