Merge branch 'master' of ssh://gonito.net/gonito

This commit is contained in:
Filip Gralinski 2018-07-05 07:01:10 +02:00
commit 2a1cfa5358
4 changed files with 20 additions and 3 deletions

View File

@ -34,6 +34,8 @@ import Data.Attoparsec.Text
import Data.Text (pack, unpack) import Data.Text (pack, unpack)
import Data.Conduit.SmartSource
getShowChallengeR :: Text -> Handler Html getShowChallengeR :: Text -> Handler Html
getShowChallengeR name = do getShowChallengeR name = do
(Entity challengeId challenge) <- runDB $ getBy404 $ UniqueName name (Entity challengeId challenge) <- runDB $ getBy404 $ UniqueName name
@ -300,6 +302,7 @@ outForTest repoDir submissionId (Entity testId test) = do
checksum <- liftIO $ gatherSHA1ForCollectionOfFiles [outF] checksum <- liftIO $ gatherSHA1ForCollectionOfFiles [outF]
return Out { return Out {
outSubmission=submissionId, outSubmission=submissionId,
outVariant=Nothing,
outTest=testId, outTest=testId,
outChecksum=SHA1 checksum } outChecksum=SHA1 checksum }
@ -325,7 +328,7 @@ checkOrInsertEvaluation repoDir chan out = do
case resultOrException of case resultOrException of
Right (Left _) -> do Right (Left _) -> do
err chan "Cannot parse options, check the challenge repo" err chan "Cannot parse options, check the challenge repo"
Right (Right (_, Just [result])) -> do Right (Right (_, Just [(_, [result])])) -> do
msg chan $ concat [ "Evaluated! Score ", (T.pack $ show result) ] msg chan $ concat [ "Evaluated! Score ", (T.pack $ show result) ]
time <- liftIO getCurrentTime time <- liftIO getCurrentTime
_ <- runDB $ insert $ Evaluation { _ <- runDB $ insert $ Evaluation {
@ -342,7 +345,7 @@ checkOrInsertEvaluation repoDir chan out = do
Left exception -> do Left exception -> do
err chan $ "Evaluation failed: " ++ (T.pack $ show exception) err chan $ "Evaluation failed: " ++ (T.pack $ show exception)
rawEval :: FilePath -> Metric -> FilePath -> Text -> IO (Either GEvalException (Either (ParserResult GEvalOptions) (GEvalOptions, Maybe [MetricValue]))) rawEval :: FilePath -> Metric -> FilePath -> Text -> IO (Either GEvalException (Either (ParserResult GEvalOptions) (GEvalOptions, Maybe [(SourceSpec, [MetricValue])])))
rawEval challengeDir metric repoDir name = Import.try (runGEvalGetOptions [ rawEval challengeDir metric repoDir name = Import.try (runGEvalGetOptions [
"--alt-metric", (show metric), "--alt-metric", (show metric),
"--expected-directory", challengeDir, "--expected-directory", challengeDir,

9
add-variants.sql Normal file
View File

@ -0,0 +1,9 @@
insert into variant(submission, name) select id, 'out' from submission;
update out
set variant=subquery.variant_id
from (select O.id as out_id, V.id as variant_id
from out as O, variant as V, submission as S
where V.submission = S.id and O.submission = S.id) AS subquery
where out.id = subquery.out_id;

View File

@ -59,6 +59,10 @@ Submission
isPublic Bool default=False isPublic Bool default=False
isHidden Bool Maybe isHidden Bool Maybe
UniqueSubmissionRepoCommitChallenge repo commit challenge UniqueSubmissionRepoCommitChallenge repo commit challenge
Variant
submission SubmissionId
name Text
UniqueVariantSubmissionName submission name
Fork Fork
source SubmissionId source SubmissionId
target SubmissionId target SubmissionId
@ -77,6 +81,7 @@ Comment
text Textarea text Textarea
Out Out
submission SubmissionId submission SubmissionId
variant VariantId Maybe
test TestId test TestId
checksum SHA1 checksum SHA1
UniqueOutSubmissionTestChecksum submission test checksum UniqueOutSubmissionTestChecksum submission test checksum

View File

@ -122,7 +122,7 @@ library
, filemanip , filemanip
, cryptohash , cryptohash
, markdown , markdown
, geval >= 1.0.0.0 , geval >= 1.1.0.0 && < 1.2
, filepath , filepath
, yesod-table , yesod-table
, regex-tdfa , regex-tdfa