From 4c5967c0a171a827cbd6c14b409c887b21d8b31d Mon Sep 17 00:00:00 2001 From: Filip Gralinski Date: Sat, 27 Feb 2021 11:57:28 +0100 Subject: [PATCH] Fix re-evaluation --- Handler/Evaluate.hs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Handler/Evaluate.hs b/Handler/Evaluate.hs index bd2e281..22a7cfc 100644 --- a/Handler/Evaluate.hs +++ b/Handler/Evaluate.hs @@ -227,16 +227,20 @@ checkOrInsertEvaluation repoDir forceEvaluation chan version out = do asPercentage = False } msg chan $ concat [ "Evaluated! Score ", (T.pack $ formatTheResult defaultFormattingOpts result) ] time <- liftIO getCurrentTime - if forceEvaluation + let (pointResult, errorBound) = extractResult result + if (isJust maybeEvaluation) then - runDB $ deleteWhere [ + runDB $ updateWhere [ EvaluationTest ==. outTest out, EvaluationChecksum ==. outChecksum out, EvaluationVersion ==. version ] + [ EvaluationScore =. Just pointResult, + EvaluationErrorBound =. errorBound, + EvaluationErrorMessage =. Nothing, + EvaluationStamp =. time ] else - return () - _ <- runDB $ insert $ let (pointResult, errorBound) = extractResult result - in Evaluation { + do + _ <- runDB $ insert $ Evaluation { evaluationTest=outTest out, evaluationChecksum=outChecksum out, evaluationScore=Just pointResult, @@ -244,6 +248,7 @@ checkOrInsertEvaluation repoDir forceEvaluation chan version out = do evaluationErrorMessage=Nothing, evaluationStamp=time, evaluationVersion=version } + return () msg chan "Evaluation done" Right (Right (_, Just _)) -> do err chan "Unexpected multiple results (???)"