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.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,

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
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

View File

@ -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