Fix broken line by line mode when viewing an output

This commit is contained in:
Filip Gralinski 2021-02-27 12:11:17 +01:00
parent 4c5967c0a1
commit f600882dea
2 changed files with 6 additions and 4 deletions

View File

@ -553,6 +553,8 @@ viewOutputWithNonDefaultTestSelected entry tests mainTest (outputHash, testSet)
let variantId = entityKey <$> tableEntryVariant <$> entry let variantId = entityKey <$> tableEntryVariant <$> entry
let theStamp = submissionStamp $ entityVal $ tableEntrySubmission $ current entry let theStamp = submissionStamp $ entityVal $ tableEntrySubmission $ current entry
let theVersion = submissionVersion $ entityVal $ tableEntrySubmission $ current entry
challenge <- handlerToWidget $ runDB $ get404 $ submissionChallenge $ entityVal $ tableEntrySubmission $ current entry challenge <- handlerToWidget $ runDB $ get404 $ submissionChallenge $ entityVal $ tableEntrySubmission $ current entry
let isNonSensitive = challengeSensitive challenge == Just False let isNonSensitive = challengeSensitive challenge == Just False
@ -623,8 +625,8 @@ viewOutputWithNonDefaultTestSelected entry tests mainTest (outputHash, testSet)
return Nothing return Nothing
$(widgetFile "view-output") $(widgetFile "view-output")
lineByLineTable :: Entity Test -> UTCTime -> Table.Table App (Int, DiffLineRecord) lineByLineTable :: Entity Test -> SHA1 -> UTCTime -> Table.Table App (Int, DiffLineRecord)
lineByLineTable (Entity testId test) theStamp = mempty lineByLineTable (Entity testId test) theVersion theStamp = mempty
++ Table.int "#" fst ++ Table.int "#" fst
++ theLimitedTextCell "input" (((\(DiffLineRecord inp _ _ _) -> inp) . snd)) ++ theLimitedTextCell "input" (((\(DiffLineRecord inp _ _ _) -> inp) . snd))
++ theLimitedTextCell "expected output" ((\(DiffLineRecord _ expected _ _) -> expected) . snd) ++ theLimitedTextCell "expected output" ((\(DiffLineRecord _ expected _ _) -> expected) . snd)
@ -637,7 +639,7 @@ lineByLineTable (Entity testId test) theStamp = mempty
evaluationErrorBound = Nothing, evaluationErrorBound = Nothing,
evaluationErrorMessage = Nothing, evaluationErrorMessage = Nothing,
evaluationStamp = theStamp, evaluationStamp = theStamp,
evaluationVersion = undefined } evaluationVersion = theVersion }
resultTable :: Entity Submission -> WidgetFor App () resultTable :: Entity Submission -> WidgetFor App ()
resultTable (Entity submissionId submission) = do resultTable (Entity submissionId submission) = do

View File

@ -10,5 +10,5 @@
$maybe result <- mResult $maybe result <- mResult
<a name="worst-items-#{testSet}"> <a name="worst-items-#{testSet}">
<h4>worst items <h4>worst items
^{Table.buildBootstrap (lineByLineTable mainTest theStamp) result} ^{Table.buildBootstrap (lineByLineTable mainTest theVersion theStamp) result}
$nothing $nothing