variant is now required for an out

This commit is contained in:
Filip Gralinski 2018-07-05 22:15:21 +02:00
parent 970e8ecf25
commit eedf1cd6fa
2 changed files with 5 additions and 5 deletions

View File

@ -281,8 +281,7 @@ getOuts chan submissionId = do
activeTests <- runDB $ selectList [TestChallenge ==. challengeId, TestActive ==. True] []
testsDone <- filterM (liftIO . doesOutExist repoDir) activeTests
theVariant <- getVariant submissionId "out"
outs' <- mapM (outForTest repoDir submissionId) testsDone
let outs = map (\o -> o { outVariant = Just theVariant}) outs'
outs <- mapM (outForTest repoDir submissionId theVariant) testsDone
mapM_ checkOrInsertOut outs
mapM_ (checkOrInsertEvaluation repoDir chan) outs
return outs
@ -299,12 +298,12 @@ doesOutExist repoDir (Entity _ test) = do
result <- findOutFile repoDir test
return $ isJust result
outForTest repoDir submissionId (Entity testId test) = do
outForTest repoDir submissionId variantId (Entity testId test) = do
(Just outF) <- liftIO $ findOutFile repoDir test
checksum <- liftIO $ gatherSHA1ForCollectionOfFiles [outF]
return Out {
outSubmission=submissionId,
outVariant=Nothing,
outVariant=variantId,
outTest=testId,
outChecksum=SHA1 checksum }

View File

@ -81,10 +81,11 @@ Comment
text Textarea
Out
submission SubmissionId
variant VariantId Maybe
variant VariantId
test TestId
checksum SHA1
UniqueOutSubmissionTestChecksum submission test checksum
UniqueOutVariantTestChecksum variant test checksum
Tag
name Text
description Text Maybe