add how-to
This commit is contained in:
parent
f57d80637b
commit
d69e953c35
@ -44,17 +44,35 @@ getChallengeReadmeR name = do
|
||||
|
||||
showChallengeWidget challenge repo = $(widgetFile "show-challenge")
|
||||
|
||||
getChallengeHowToR :: Text -> Handler Html
|
||||
getChallengeHowToR name = do
|
||||
(Entity _ challenge) <- runDB $ getBy404 $ UniqueName name
|
||||
maybeUser <- maybeAuth
|
||||
challengeLayout False challenge (challengeHowTo challenge (idToBeShown challenge maybeUser))
|
||||
|
||||
idToBeShown challenge maybeUser =
|
||||
case maybeUser of
|
||||
Just user -> case userLocalId $ entityVal user of
|
||||
Just localId -> localId
|
||||
Nothing -> defaultIdToBe
|
||||
Nothing -> defaultIdToBe
|
||||
where defaultIdToBe = "YOURID" :: Text
|
||||
|
||||
defaultRepo challenge maybeUser = "ssh://gitolite@gonito.net/" ++ (idToBeShown challenge maybeUser) ++ "/" ++ (challengeName challenge)
|
||||
|
||||
challengeHowTo challenge idToBeShown = $(widgetFile "challenge-how-to")
|
||||
|
||||
getChallengeSubmissionR :: Text -> Handler Html
|
||||
getChallengeSubmissionR name = do
|
||||
(Entity _ challenge) <- runDB $ getBy404 $ UniqueName name
|
||||
(formWidget, formEnctype) <- generateFormPost submissionForm
|
||||
maybeUser <- maybeAuth
|
||||
(formWidget, formEnctype) <- generateFormPost $ submissionForm (Just $ defaultRepo challenge maybeUser)
|
||||
challengeLayout True challenge $ challengeSubmissionWidget formWidget formEnctype challenge
|
||||
|
||||
postChallengeSubmissionR :: Text -> Handler TypedContent
|
||||
postChallengeSubmissionR name = do
|
||||
(Entity challengeId challenge) <- runDB $ getBy404 $ UniqueName name
|
||||
((result, formWidget), formEnctype) <- runFormPost submissionForm
|
||||
((result, formWidget), formEnctype) <- runFormPost $ submissionForm Nothing
|
||||
let submissionData = case result of
|
||||
FormSuccess res -> Just res
|
||||
_ -> Nothing
|
||||
@ -203,11 +221,11 @@ checkRepoAvailibility challengeId repoId chan = do
|
||||
|
||||
challengeSubmissionWidget formWidget formEnctype challenge = $(widgetFile "challenge-submission")
|
||||
|
||||
submissionForm :: Form (Text, Text, Text)
|
||||
submissionForm = renderBootstrap3 BootstrapBasicForm $ (,,)
|
||||
submissionForm :: Maybe Text -> Form (Text, Text, Text)
|
||||
submissionForm defaultUrl = renderBootstrap3 BootstrapBasicForm $ (,,)
|
||||
<$> areq textField (fieldSettingsLabel MsgSubmissionDescription) Nothing
|
||||
<*> areq textField (fieldSettingsLabel MsgSubmissionUrl) Nothing
|
||||
<*> areq textField (fieldSettingsLabel MsgSubmissionBranch) Nothing
|
||||
<*> areq textField (fieldSettingsLabel MsgSubmissionUrl) defaultUrl
|
||||
<*> areq textField (fieldSettingsLabel MsgSubmissionBranch) (Just "master")
|
||||
|
||||
getChallengeMySubmissionsR :: Text -> Handler Html
|
||||
getChallengeMySubmissionsR name = do
|
||||
|
@ -16,5 +16,6 @@
|
||||
/challenge-submission/#Text ChallengeSubmissionR GET POST
|
||||
/challenge-my-submissions/#Text ChallengeMySubmissionsR GET
|
||||
/challenge-all-submissions/#Text ChallengeAllSubmissionsR GET
|
||||
/challenge-how-to/#Text ChallengeHowToR GET
|
||||
|
||||
/account YourAccountR GET POST
|
||||
|
43
templates/challenge-how-to.hamlet
Normal file
43
templates/challenge-how-to.hamlet
Normal file
@ -0,0 +1,43 @@
|
||||
<h1>Challenge How To
|
||||
|
||||
<h2>Install GEval
|
||||
|
||||
<p>In order to evaluate your work locally, you need the GEval tool. First install <a href="https://github.com/commercialhaskell/stack">Haskell Stack</a> and then install GEval itselt:
|
||||
|
||||
<pre>
|
||||
git clone git://gonito.net/geval
|
||||
cd geval
|
||||
stack setup
|
||||
stack install
|
||||
|
||||
<h2>Get your repo
|
||||
|
||||
<p>You need to upload your SSH public key (see <a href="@{YourAccountR}">your account</a>) if you want to have a repo hosted on Gonito.net, then:
|
||||
|
||||
<pre>
|
||||
git clone ssh://gitolite@gonito.net/#{idToBeShown}/#{challengeName challenge}
|
||||
cd #{challengeName challenge}
|
||||
git pull ssh://gitolite@gonito.net/#{challengeName challenge}
|
||||
git push origin master
|
||||
|
||||
<h2>Work on your solution
|
||||
|
||||
<p>You need to generate your solution for the test set as <tt>test-A/out.tsv</tt>. You may also generate the solution for the dev set (<tt>dev-0/out.tsv</tt>).
|
||||
|
||||
<p>You can evaluate results for the dev set locally:
|
||||
|
||||
<pre>
|
||||
cd #{challengeName challenge}
|
||||
geval --test-name dev-0
|
||||
|
||||
<h2>Submit your solution
|
||||
|
||||
<p>Push <tt>out.tsv</tt> files to your repo. It is also recommended to push your source codes along with <tt>out.tsv</tt> files.
|
||||
|
||||
<pre>
|
||||
cd #{challengeName challenge}
|
||||
git add dev-0/out.tsv test-A/out.tsv # also your source codes could be added
|
||||
git commit -m 'my brilliant solution'
|
||||
git push origin master
|
||||
|
||||
<p>Finally, you need to tell Gonito.net to evaluate your submission. Go to the <a href="@{ChallengeSubmissionR $ challengeName challenge}">submit form</a>.
|
@ -2,8 +2,9 @@
|
||||
<div .row>
|
||||
<div .col-md-2 role="complementary">
|
||||
<ul class="nav nav-pills nav-stacked navbar-left">
|
||||
<li role="presentation" class="active"><a href="@{ShowChallengeR (challengeName challenge)}">Graph</a>
|
||||
<li role="presentation" class="active"><a href="@{ShowChallengeR (challengeName challenge)}">Challenge</a>
|
||||
<li role="presentation"><a href="@{ChallengeReadmeR (challengeName challenge)}">Readme</a>
|
||||
<li role="presentation"><a href="@{ChallengeHowToR (challengeName challenge)}">How To</a>
|
||||
<li role="presentation"><a href="@{ChallengeSubmissionR (challengeName challenge)}">Submit</a>
|
||||
<li role="presentation"><a href="@{ChallengeMySubmissionsR (challengeName challenge)}">My Submissions</a>
|
||||
<li role="presentation"><a href="@{ChallengeAllSubmissionsR (challengeName challenge)}">All Submissions</a>
|
||||
|
Loading…
Reference in New Issue
Block a user