ExcerciseBuddies for DefinedGroups are forced

This commit is contained in:
SJost 2018-04-19 10:56:32 +02:00
parent 780201703c
commit 11c17e3dc8

View File

@ -55,15 +55,18 @@ makeSubmissionForm :: Bool -> SheetGroup -> [Text] -> Form (Source Handler File,
makeSubmissionForm unpackZips grouping buddies = identForm FIDsubmission $ \html -> do
flip (renderAForm FormStandard) html $ (,)
<$> areq (zipFileField unpackZips) (fsm $ bool MsgSubmissionFile MsgSubmissionArchive unpackZips) Nothing
<*> (catMaybes <$> sequenceA [aopt textField (fsm $ MsgSubmissionMember g) buddy
<*> (catMaybes <$> sequenceA [bool aforced' aopt editableBuddies textField (fsm $ MsgSubmissionMember g) buddy
| g <- [1..(max groupNr $ length buddies)] -- groupNr might have decreased meanwhile
| buddy <- map (Just . Just) buddies ++ repeat Nothing -- show current buddies
])
<* submitButton
where
groupNr
| Arbitrary{..} <- grouping = pred maxParticipants -- pred to account for the person submitting
| otherwise = 0
(groupNr, editableBuddies)
| Arbitrary{..} <- grouping = (pred maxParticipants, True) -- pred to account for the person submitting
| otherwise = (0, False)
aforced' f fs (Just (Just v)) = Just <$> aforced f fs v
aforced' _ _ _ = error "Cannot happen since groupNr==0 if grouping/=Arbitrary"
getSubmissionR, postSubmissionR :: TermId -> Text -> Text -> SubmissionMode -> Handler Html