improve showing query results, fix issue with triggering evaluation for the first time

This commit is contained in:
Filip Gralinski 2018-08-30 21:58:27 +02:00
parent 5a7c7431ce
commit d9a3d56d3d
3 changed files with 11 additions and 10 deletions

View File

@ -122,11 +122,12 @@ cloneRepo repoCloningSpec chan = do
let url = repoSpecUrl $ cloningSpecRepo repoCloningSpec
let branch = repoSpecBranch $ cloningSpecRepo repoCloningSpec
maybeRepo <- runDB $ getBy $ UniqueUrlBranch url branch
userId <- requireAuthId
case maybeRepo of
Just _ -> do
err chan "Repo already there"
return Nothing
Nothing -> cloneRepo' repoCloningSpec chan
Nothing -> cloneRepo' userId repoCloningSpec chan
updateRepo :: Key Repo -> Channel -> Handler Bool
updateRepo repoId chan = do
@ -172,8 +173,8 @@ getLastCommitMessage repoDir chan = do
ExitSuccess -> Just out
ExitFailure _ -> Nothing
cloneRepo' :: RepoCloningSpec -> Channel -> Handler (Maybe (Key Repo))
cloneRepo' repoCloningSpec chan = do
cloneRepo' :: UserId -> RepoCloningSpec -> Channel -> Handler (Maybe (Key Repo))
cloneRepo' userId repoCloningSpec chan = do
let url = repoSpecUrl $ cloningSpecRepo repoCloningSpec
msg chan $ concat ["Preparing to clone repo ", url]
msg chan "Cloning..."
@ -186,7 +187,6 @@ cloneRepo' repoCloningSpec chan = do
maybeHeadCommit <- getHeadCommit tmpRepoDir chan
case maybeHeadCommit of
Just commitRaw -> do
userId <- requireAuthId
time <- liftIO getCurrentTime
repoId <- runDB $ insert $ Repo {
repoUrl=url,

View File

@ -226,7 +226,7 @@ trigger userId challengeName url mBranch = do
doCreateSubmission :: UserId -> Key Challenge -> Maybe Text -> Maybe Text -> RepoSpec -> Channel -> Handler ()
doCreateSubmission userId challengeId mDescription mTags repoSpec chan = do
maybeRepoKey <- getSubmissionRepo challengeId repoSpec chan
maybeRepoKey <- getSubmissionRepo userId challengeId repoSpec chan
case maybeRepoKey of
Just repoId -> do
repo <- runDB $ get404 repoId
@ -445,8 +445,8 @@ rawEval challengeDir metric repoDir name outF = Import.try (runGEvalGetOptions [
"--out-file", outF,
"--test-name", (T.unpack name)])
getSubmissionRepo :: Key Challenge -> RepoSpec -> Channel -> Handler (Maybe (Key Repo))
getSubmissionRepo challengeId repoSpec chan = do
getSubmissionRepo :: UserId -> Key Challenge -> RepoSpec -> Channel -> Handler (Maybe (Key Repo))
getSubmissionRepo userId challengeId repoSpec chan = do
let url = repoSpecUrl repoSpec
let branch = repoSpecBranch repoSpec
let gitAnnexRemote = repoSpecGitAnnexRemote repoSpec
@ -482,7 +482,7 @@ getSubmissionRepo challengeId repoSpec chan = do
repoSpecGitAnnexRemote = Nothing
}
}
cloneRepo' repoCloningSpec chan
cloneRepo' userId repoCloningSpec chan
checkRepoAvailibility :: Key Challenge -> Key Repo -> Channel -> Handler Bool
checkRepoAvailibility challengeId repoId chan = do

View File

@ -2,8 +2,9 @@
<div .subm-description>#{submissionDescription $ fsiSubmission submission}
<div .subm-user>#{submitter}
<div .subm-stamp>#{stamp}
<div .subm-repo>taken from: #{repoUrl $ fsiRepo submission} / branch #{repoBranch $ fsiRepo submission}
<div .subm-repo>taken from: <code>#{repoUrl $ fsiRepo submission}</code> / branch <code>#{repoBranch $ fsiRepo submission}</code>
$if submissionIsPublic $ fsiSubmission submission
<div .subm-repo>publicly available at: #{publicSubmissionRepo} / branch #{publicSubmissionBranch}
<div .subm-repo>publicly available at: <code>#{publicSubmissionRepo}</code> / branch <code>#{publicSubmissionBranch}</code>
<div .subm-browsable>browsable at: <a href="#{browsableUrl}">#{browsableUrl}</a>
<div .subm-clonable>to get it run: <code>git clone #{publicSubmissionRepo} -b #{publicSubmissionBranch}</code>
<hr>