From 1aafff18082f06472194d6142fa54db6ca2f62f0 Mon Sep 17 00:00:00 2001 From: Filip Gralinski Date: Sat, 8 Sep 2018 09:03:22 +0200 Subject: [PATCH] Do not use scientific formatting of scores --- Handler/Shared.hs | 5 ++++- Handler/ShowChallenge.hs | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Handler/Shared.hs b/Handler/Shared.hs index ef745ce..a145e66 100644 --- a/Handler/Shared.hs +++ b/Handler/Shared.hs @@ -338,8 +338,11 @@ testComparator (Entity _ a) (Entity _ b) = ((fromMaybe unknownPriority $ testPriority b) `compare` (fromMaybe unknownPriority $ testPriority a)) where unknownPriority = 9999 +formatNonScientifically :: Double -> Text +formatNonScientifically = T.pack . (printf "%f") + formatFullScore :: Maybe Evaluation -> Text -formatFullScore (Just evaluation) = fromMaybe "???" (T.pack <$> show <$> evaluationScore evaluation) +formatFullScore (Just evaluation) = fromMaybe "???" (formatNonScientifically <$> evaluationScore evaluation) formatFullScore Nothing = "N/A" formatTruncatedScore :: Maybe Int -> Maybe Evaluation -> Text diff --git a/Handler/ShowChallenge.hs b/Handler/ShowChallenge.hs index 2ad8ae5..1006532 100644 --- a/Handler/ShowChallenge.hs +++ b/Handler/ShowChallenge.hs @@ -419,7 +419,7 @@ checkOrInsertEvaluation repoDir chan out = do maybeEvaluation <- runDB $ getBy $ UniqueEvaluationTestChecksum (outTest out) (outChecksum out) case maybeEvaluation of Just (Entity _ evaluation) -> do - msg chan $ concat ["Already evaluated with score ", (T.pack $ fromMaybe "???" $ show <$> evaluationScore evaluation)] + msg chan $ concat ["Already evaluated with score ", (fromMaybe "???" $ formatNonScientifically <$> evaluationScore evaluation)] Nothing -> do msg chan $ "Start evaluation..." challengeDir <- getRepoDir $ challengePrivateRepo challenge @@ -429,7 +429,7 @@ checkOrInsertEvaluation repoDir chan out = do Right (Left _) -> do err chan "Cannot parse options, check the challenge repo" Right (Right (_, Just [(_, [result])])) -> do - msg chan $ concat [ "Evaluated! Score ", (T.pack $ show result) ] + msg chan $ concat [ "Evaluated! Score ", (formatNonScientifically result) ] time <- liftIO getCurrentTime _ <- runDB $ insert $ Evaluation { evaluationTest=outTest out,