forked from filipg/gonito
start evaluation
This commit is contained in:
parent
4b138e3e36
commit
d30e61961f
@ -77,8 +77,8 @@ getSubmission repoId commit challengeId description chan = do
|
|||||||
submissionDescription=description,
|
submissionDescription=description,
|
||||||
submissionStamp=time }
|
submissionStamp=time }
|
||||||
|
|
||||||
getOuts :: Key Submission -> Handler ([Out])
|
getOuts :: Channel -> Key Submission -> Handler ([Out])
|
||||||
getOuts submissionId = do
|
getOuts chan submissionId = do
|
||||||
submission <- runDB $ get404 submissionId
|
submission <- runDB $ get404 submissionId
|
||||||
let challengeId = submissionChallenge submission
|
let challengeId = submissionChallenge submission
|
||||||
let repoDir = getRepoDir $ submissionRepo submission
|
let repoDir = getRepoDir $ submissionRepo submission
|
||||||
@ -86,6 +86,7 @@ getOuts submissionId = do
|
|||||||
testsDone <- filterM (doesOutExist repoDir) activeTests
|
testsDone <- filterM (doesOutExist repoDir) activeTests
|
||||||
outs <- mapM (outForTest repoDir submissionId) testsDone
|
outs <- mapM (outForTest repoDir submissionId) testsDone
|
||||||
mapM_ checkOrInsertOut outs
|
mapM_ checkOrInsertOut outs
|
||||||
|
mapM_ (checkOrInsertEvaluation repoDir chan) outs
|
||||||
return outs
|
return outs
|
||||||
|
|
||||||
outFileName = "out.tsv"
|
outFileName = "out.tsv"
|
||||||
@ -108,6 +109,16 @@ checkOrInsertOut out = do
|
|||||||
Just _ -> return ()
|
Just _ -> return ()
|
||||||
Nothing -> (runDB $ insert out) >> return ()
|
Nothing -> (runDB $ insert out) >> return ()
|
||||||
|
|
||||||
|
checkOrInsertEvaluation :: FilePath -> Channel -> Out -> Handler ()
|
||||||
|
checkOrInsertEvaluation repoDir chan out = do
|
||||||
|
test <- runDB $ get404 $ outTest out
|
||||||
|
maybeEvaluation <- runDB $ getBy $ UniqueEvaluationTestChecksum (outTest out) (outChecksum out)
|
||||||
|
case maybeEvaluation of
|
||||||
|
Just (Entity _ evaluation) -> do
|
||||||
|
msg chan $ concat ["Already evaluated with score ", (T.pack $ fromMaybe "???" $ show <$> evaluationScore evaluation)]
|
||||||
|
Nothing -> do
|
||||||
|
msg chan $ "Start evaluation..."
|
||||||
|
|
||||||
getSubmissionRepo :: Key Challenge -> Text -> Text -> Channel -> Handler (Maybe (Key Repo))
|
getSubmissionRepo :: Key Challenge -> Text -> Text -> Channel -> Handler (Maybe (Key Repo))
|
||||||
getSubmissionRepo challengeId url branch chan = do
|
getSubmissionRepo challengeId url branch chan = do
|
||||||
maybeRepo <- runDB $ getBy $ UniqueUrlBranch url branch
|
maybeRepo <- runDB $ getBy $ UniqueUrlBranch url branch
|
||||||
|
@ -45,7 +45,7 @@ Evaluation
|
|||||||
score Double Maybe
|
score Double Maybe
|
||||||
errorMessage Text Maybe
|
errorMessage Text Maybe
|
||||||
stamp UTCTime default=now()
|
stamp UTCTime default=now()
|
||||||
UniqueTestChecksum test checksum
|
UniqueEvaluationTestChecksum test checksum
|
||||||
Out
|
Out
|
||||||
submission SubmissionId
|
submission SubmissionId
|
||||||
test TestId
|
test TestId
|
||||||
|
Loading…
Reference in New Issue
Block a user