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