From 11c17e3dc8c9768ad7df0c9b1ce543d84c5f9cea Mon Sep 17 00:00:00 2001 From: SJost Date: Thu, 19 Apr 2018 10:56:32 +0200 Subject: [PATCH] ExcerciseBuddies for DefinedGroups are forced --- src/Handler/Submission.hs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Handler/Submission.hs b/src/Handler/Submission.hs index 941b4e38b..7aadaa67c 100644 --- a/src/Handler/Submission.hs +++ b/src/Handler/Submission.hs @@ -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