forked from filipg/gonito
Handle two modes for gold standard when showing line-by-line mode
This commit is contained in:
parent
e27de3d0c2
commit
f0a2cde5db
@ -547,6 +547,14 @@ getScoreFromDiff (DiffLineRecord _ _ (OneThing (_, s)) _) = s
|
|||||||
getScoreFromDiff (DiffLineRecord _ _ (TwoThings (_, oldS) (_, newS)) _) = newS - oldS
|
getScoreFromDiff (DiffLineRecord _ _ (TwoThings (_, oldS) (_, newS)) _) = newS - oldS
|
||||||
|
|
||||||
|
|
||||||
|
data SourceOfExpected = NoExpectedFound | ExpectedFromSubmission | ExpectedFromChallenge
|
||||||
|
deriving (Eq, Show)
|
||||||
|
|
||||||
|
checkForExpected repoDir testName = do
|
||||||
|
expFile <- lookForCompressedFiles (repoDir </> testName </> "expected.tsv")
|
||||||
|
expFileExists <- D.doesFileExist expFile
|
||||||
|
return expFileExists
|
||||||
|
|
||||||
viewOutputWithNonDefaultTestSelected :: Diff TableEntry
|
viewOutputWithNonDefaultTestSelected :: Diff TableEntry
|
||||||
-> [Entity Test]
|
-> [Entity Test]
|
||||||
-> Entity Test
|
-> Entity Test
|
||||||
@ -591,17 +599,29 @@ viewOutputWithNonDefaultTestSelected entry tests mainTest (outputHash, testSet)
|
|||||||
|
|
||||||
let testName = T.unpack testSet
|
let testName = T.unpack testSet
|
||||||
|
|
||||||
Right opts <- liftIO $ readOptsFromConfigFile [] (current repoDir </> "config.txt")
|
challengeRepoDir <- handlerToWidget $ getRepoDir (challengePublicRepo challenge)
|
||||||
|
expFileExistsInChallengeRepo <- liftIO $ checkForExpected challengeRepoDir testName
|
||||||
|
|
||||||
expFile <- liftIO $ lookForCompressedFiles (current repoDir </> testName </> "expected.tsv")
|
expFileExists <- liftIO $ checkForExpected (current repoDir) testName
|
||||||
|
|
||||||
expFileExists <- liftIO $ D.doesFileExist expFile
|
let expFileStatus = if expFileExists
|
||||||
|
then ExpectedFromSubmission
|
||||||
|
else
|
||||||
|
if expFileExistsInChallengeRepo
|
||||||
|
then ExpectedFromChallenge
|
||||||
|
else NoExpectedFound
|
||||||
|
|
||||||
if expFileExists
|
if expFileStatus /= NoExpectedFound
|
||||||
then do
|
then do
|
||||||
|
let theRepoDir = case expFileStatus of
|
||||||
|
ExpectedFromSubmission -> (current repoDir)
|
||||||
|
ExpectedFromChallenge -> challengeRepoDir
|
||||||
|
NoExpectedFound -> error "Should not be here"
|
||||||
|
|
||||||
|
Right opts <- liftIO $ readOptsFromConfigFile [] (theRepoDir </> "config.txt")
|
||||||
let spec = GEvalSpecification {
|
let spec = GEvalSpecification {
|
||||||
gesOutDirectory = current repoDir,
|
gesOutDirectory = current repoDir,
|
||||||
gesExpectedDirectory = Nothing,
|
gesExpectedDirectory = Just theRepoDir,
|
||||||
gesTestName = testName,
|
gesTestName = testName,
|
||||||
gesSelector = Nothing,
|
gesSelector = Nothing,
|
||||||
gesOutFile = outFile,
|
gesOutFile = outFile,
|
||||||
@ -627,14 +647,14 @@ viewOutputWithNonDefaultTestSelected entry tests mainTest (outputHash, testSet)
|
|||||||
result <- liftIO $ runLineByLineGeneralized FirstTheWorst
|
result <- liftIO $ runLineByLineGeneralized FirstTheWorst
|
||||||
spec
|
spec
|
||||||
(\_ -> CL.take maximumNumberOfItemsToBeShown)
|
(\_ -> CL.take maximumNumberOfItemsToBeShown)
|
||||||
return $ Just $ zip [1..] $ map getUniLineRecord result
|
return $ Just (expFileStatus, zip [1..] $ map getUniLineRecord result)
|
||||||
TwoThings (Just (oldRepoDir, oldOutFilePath)) _ -> do
|
TwoThings (Just (oldRepoDir, oldOutFilePath)) _ -> do
|
||||||
absOldOutFilePath <- liftIO $ makeAbsolute (oldRepoDir </> testName </> (takeFileName oldOutFilePath))
|
absOldOutFilePath <- liftIO $ makeAbsolute (oldRepoDir </> testName </> (takeFileName oldOutFilePath))
|
||||||
result <- liftIO $ runDiffGeneralized FirstTheWorst
|
result <- liftIO $ runDiffGeneralized FirstTheWorst
|
||||||
absOldOutFilePath
|
absOldOutFilePath
|
||||||
spec
|
spec
|
||||||
(\_ -> CL.take maximumNumberOfItemsToBeShown)
|
(\_ -> CL.take maximumNumberOfItemsToBeShown)
|
||||||
return $ Just $ zip [1..] $ map getBiLineRecord result
|
return $ Just (expFileStatus, zip [1..] $ map getBiLineRecord result)
|
||||||
else
|
else
|
||||||
do
|
do
|
||||||
return Nothing
|
return Nothing
|
||||||
|
@ -7,8 +7,13 @@
|
|||||||
<div .subm-commit>#{testSet} / #{outputSha1AsText}
|
<div .subm-commit>#{testSet} / #{outputSha1AsText}
|
||||||
$forall crossTable <- crossTables
|
$forall crossTable <- crossTables
|
||||||
^{Table.buildBootstrap (crossTableDefinition variantId crossTable) (crossTableBody crossTable)}
|
^{Table.buildBootstrap (crossTableDefinition variantId crossTable) (crossTableBody crossTable)}
|
||||||
$maybe result <- mResult
|
$maybe (expFileStatus, result) <- mResult
|
||||||
<a name="worst-items-#{testSet}">
|
<a name="worst-items-#{testSet}">
|
||||||
<h4>worst items
|
<h4>worst items
|
||||||
|
$case expFileStatus
|
||||||
|
$of ExpectedFromSubmission
|
||||||
|
note: the gold standard is taken from the submission itself, not from the challenge data!
|
||||||
|
$of ExpectedFromChallenge
|
||||||
|
note: the gold standard is taken from the challenge
|
||||||
^{Table.buildBootstrap (lineByLineTable mainTest theVersion theStamp) result}
|
^{Table.buildBootstrap (lineByLineTable mainTest theVersion theStamp) result}
|
||||||
$nothing
|
$nothing
|
||||||
|
Loading…
Reference in New Issue
Block a user