From f600882dea985ea64950021c7c7843c86a80d244 Mon Sep 17 00:00:00 2001 From: Filip Gralinski Date: Sat, 27 Feb 2021 12:11:17 +0100 Subject: [PATCH] Fix broken line by line mode when viewing an output --- Handler/Query.hs | 8 +++++--- templates/view-output.hamlet | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Handler/Query.hs b/Handler/Query.hs index d4fc908..75c2785 100644 --- a/Handler/Query.hs +++ b/Handler/Query.hs @@ -553,6 +553,8 @@ viewOutputWithNonDefaultTestSelected entry tests mainTest (outputHash, testSet) let variantId = entityKey <$> tableEntryVariant <$> entry let theStamp = submissionStamp $ entityVal $ tableEntrySubmission $ current entry + let theVersion = submissionVersion $ entityVal $ tableEntrySubmission $ current entry + challenge <- handlerToWidget $ runDB $ get404 $ submissionChallenge $ entityVal $ tableEntrySubmission $ current entry let isNonSensitive = challengeSensitive challenge == Just False @@ -623,8 +625,8 @@ viewOutputWithNonDefaultTestSelected entry tests mainTest (outputHash, testSet) return Nothing $(widgetFile "view-output") -lineByLineTable :: Entity Test -> UTCTime -> Table.Table App (Int, DiffLineRecord) -lineByLineTable (Entity testId test) theStamp = mempty +lineByLineTable :: Entity Test -> SHA1 -> UTCTime -> Table.Table App (Int, DiffLineRecord) +lineByLineTable (Entity testId test) theVersion theStamp = mempty ++ Table.int "#" fst ++ theLimitedTextCell "input" (((\(DiffLineRecord inp _ _ _) -> inp) . snd)) ++ theLimitedTextCell "expected output" ((\(DiffLineRecord _ expected _ _) -> expected) . snd) @@ -637,7 +639,7 @@ lineByLineTable (Entity testId test) theStamp = mempty evaluationErrorBound = Nothing, evaluationErrorMessage = Nothing, evaluationStamp = theStamp, - evaluationVersion = undefined } + evaluationVersion = theVersion } resultTable :: Entity Submission -> WidgetFor App () resultTable (Entity submissionId submission) = do diff --git a/templates/view-output.hamlet b/templates/view-output.hamlet index dc609d6..fa4366c 100644 --- a/templates/view-output.hamlet +++ b/templates/view-output.hamlet @@ -10,5 +10,5 @@ $maybe result <- mResult

worst items - ^{Table.buildBootstrap (lineByLineTable mainTest theStamp) result} + ^{Table.buildBootstrap (lineByLineTable mainTest theVersion theStamp) result} $nothing