clean up ShowChallenge

This commit is contained in:
Filip Gralinski 2018-07-28 21:36:45 +02:00
parent 701223e27a
commit 3a4c85c501
2 changed files with 18 additions and 6 deletions

View File

@ -53,7 +53,12 @@ getShowChallengeR name = do
challengeRepo <- runDB $ get404 $ challengePublicRepo challenge challengeRepo <- runDB $ get404 $ challengePublicRepo challenge
challengeLayout True challenge (showChallengeWidget muserId challenge scheme challengeRepo mainTest repo leaderboard) challengeLayout True challenge (showChallengeWidget muserId
challenge scheme
challengeRepo
mainTest
repo
leaderboard)
getChallengeReadmeR :: Text -> Handler Html getChallengeReadmeR :: Text -> Handler Html
getChallengeReadmeR name = do getChallengeReadmeR name = do
@ -70,7 +75,14 @@ challengeReadme name = do
contents <- liftIO $ System.IO.readFile readmeFilePath contents <- liftIO $ System.IO.readFile readmeFilePath
return $ markdown def $ TL.pack contents return $ markdown def $ TL.pack contents
showChallengeWidget :: Maybe UserId -> Challenge -> RepoScheme -> Repo -> Test -> Repo -> [LeaderboardEntry] -> WidgetFor App () showChallengeWidget :: Maybe UserId
-> Challenge
-> RepoScheme
-> Repo
-> Test
-> Repo
-> [LeaderboardEntry]
-> WidgetFor App ()
showChallengeWidget muserId challenge scheme challengeRepo test repo leaderboard = $(widgetFile "show-challenge") showChallengeWidget muserId challenge scheme challengeRepo test repo leaderboard = $(widgetFile "show-challenge")
where leaderboardWithRanks = zip [1..] leaderboard where leaderboardWithRanks = zip [1..] leaderboard
maybeRepoLink = getRepoLink repo maybeRepoLink = getRepoLink repo
@ -139,7 +151,7 @@ defaultBranch :: IsString a => RepoScheme -> Maybe a
defaultBranch SelfHosted = Just "master" defaultBranch SelfHosted = Just "master"
defaultBranch Branches = Nothing defaultBranch Branches = Nothing
challengeHowTo challenge settings repo idToBeShown isIDSet isSSHUploaded mToken = $(widgetFile "challenge-how-to") challengeHowTo challenge settings repo shownId isIDSet isSSHUploaded mToken = $(widgetFile "challenge-how-to")
getChallengeSubmissionR :: Text -> Handler Html getChallengeSubmissionR :: Text -> Handler Html
getChallengeSubmissionR name = do getChallengeSubmissionR name = do

View File

@ -42,7 +42,7 @@ $case (appRepoScheme settings)
\ (see <a href="@{YourAccountR}">your account</a>) if you want to have a repo hosted on Gonito.net, then: \ (see <a href="@{YourAccountR}">your account</a>) if you want to have a repo hosted on Gonito.net, then:
<pre> <pre>
git clone #{appRepoHost settings}#{idToBeShown}/#{challengeName challenge} git clone #{appRepoHost settings}#{shownId}/#{challengeName challenge}
<p>(Warning about empty repository is expected, don't worry about it.) <p>(Warning about empty repository is expected, don't worry about it.)
@ -86,14 +86,14 @@ $case (appRepoScheme settings)
cd #{challengeName challenge} cd #{challengeName challenge}
git add foo.py build.sh # add your source codes git add foo.py build.sh # add your source codes
$maybe gitAnnexRemote <- (repoGitAnnexRemote repo) $if isJust (repoGitAnnexRemote repo)
<pre> <pre>
# if your output files are large or if they should not pushed to the regular repo (e.g. contain sensitive information): # if your output files are large or if they should not pushed to the regular repo (e.g. contain sensitive information):
git annex add dev-0/out.tsv test-A/out.tsv git annex add dev-0/out.tsv test-A/out.tsv
git annex copy --to storage git annex copy --to storage
# otherwise (e.g. they are just class labels), add the output files in a regular manner: # otherwise (e.g. they are just class labels), add the output files in a regular manner:
git add dev-0/out.tsv test-A/out.tsv git add dev-0/out.tsv test-A/out.tsv
$nothing $else
<pre> <pre>
git add dev-0/out.tsv test-A/out.tsv # add your output files git add dev-0/out.tsv test-A/out.tsv # add your output files