add challenge

This commit is contained in:
Filip Gralinski 2015-09-04 10:16:12 +02:00
parent 62bd9a514f
commit c1ed05edf0

View File

@ -33,8 +33,24 @@ doCreateChallenge name publicUrl publicBranch privateUrl privateBranch chan = do
case maybePublicRepoId of
Just publicRepoId -> do
maybePrivateRepoId <- cloneRepo privateUrl privateBranch chan
return ()
case maybePrivateRepoId of
Just privateRepoId -> addChallenge name publicRepoId privateRepoId chan
Nothing -> return ()
Nothing -> return ()
addChallenge :: Text -> (Key Repo) -> (Key Repo) -> Channel -> Handler ()
addChallenge name publicRepoId privateRepoId chan = do
msg chan "adding challenge..."
time <- liftIO getCurrentTime
challengeId <- runDB $ insert $ Challenge {
challengePublicRepo=publicRepoId,
challengePrivateRepo=privateRepoId,
challengeName=name,
challengeTitle="[UNKNOWN TITLE]",
challengeDescription="[UNKNOWN DESCRIPTION]",
challengeStamp=time}
return ()
sampleForm :: Form (Text, Text, Text, Text, Text)
sampleForm = renderBootstrap3 BootstrapBasicForm $ (,,,,)