diff --git a/Handler/ShowChallenge.hs b/Handler/ShowChallenge.hs index 9ebb06e..ed43815 100644 --- a/Handler/ShowChallenge.hs +++ b/Handler/ShowChallenge.hs @@ -34,6 +34,8 @@ import Data.Attoparsec.Text import Data.Text (pack, unpack) +import Data.Conduit.SmartSource + getShowChallengeR :: Text -> Handler Html getShowChallengeR name = do (Entity challengeId challenge) <- runDB $ getBy404 $ UniqueName name @@ -300,6 +302,7 @@ outForTest repoDir submissionId (Entity testId test) = do checksum <- liftIO $ gatherSHA1ForCollectionOfFiles [outF] return Out { outSubmission=submissionId, + outVariant=Nothing, outTest=testId, outChecksum=SHA1 checksum } @@ -325,7 +328,7 @@ checkOrInsertEvaluation repoDir chan out = do case resultOrException of Right (Left _) -> do 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) ] time <- liftIO getCurrentTime _ <- runDB $ insert $ Evaluation { @@ -342,7 +345,7 @@ checkOrInsertEvaluation repoDir chan out = do Left exception -> do 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 [ "--alt-metric", (show metric), "--expected-directory", challengeDir, diff --git a/add-variants.sql b/add-variants.sql new file mode 100644 index 0000000..82b144e --- /dev/null +++ b/add-variants.sql @@ -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; diff --git a/config/models b/config/models index cc32007..93eeda4 100644 --- a/config/models +++ b/config/models @@ -59,6 +59,10 @@ Submission isPublic Bool default=False isHidden Bool Maybe UniqueSubmissionRepoCommitChallenge repo commit challenge +Variant + submission SubmissionId + name Text + UniqueVariantSubmissionName submission name Fork source SubmissionId target SubmissionId @@ -77,6 +81,7 @@ Comment text Textarea Out submission SubmissionId + variant VariantId Maybe test TestId checksum SHA1 UniqueOutSubmissionTestChecksum submission test checksum diff --git a/gonito.cabal b/gonito.cabal index cf81981..bd42688 100644 --- a/gonito.cabal +++ b/gonito.cabal @@ -122,7 +122,7 @@ library , filemanip , cryptohash , markdown - , geval >= 1.0.0.0 + , geval >= 1.1.0.0 && < 1.2 , filepath , yesod-table , regex-tdfa