Do not use scientific formatting of scores

This commit is contained in:
Filip Gralinski 2018-09-08 09:03:22 +02:00
parent 2ed724bf05
commit 1aafff1808
2 changed files with 6 additions and 3 deletions

View File

@ -338,8 +338,11 @@ testComparator (Entity _ a) (Entity _ b) =
((fromMaybe unknownPriority $ testPriority b) `compare` (fromMaybe unknownPriority $ testPriority a)) ((fromMaybe unknownPriority $ testPriority b) `compare` (fromMaybe unknownPriority $ testPriority a))
where unknownPriority = 9999 where unknownPriority = 9999
formatNonScientifically :: Double -> Text
formatNonScientifically = T.pack . (printf "%f")
formatFullScore :: Maybe Evaluation -> Text formatFullScore :: Maybe Evaluation -> Text
formatFullScore (Just evaluation) = fromMaybe "???" (T.pack <$> show <$> evaluationScore evaluation) formatFullScore (Just evaluation) = fromMaybe "???" (formatNonScientifically <$> evaluationScore evaluation)
formatFullScore Nothing = "N/A" formatFullScore Nothing = "N/A"
formatTruncatedScore :: Maybe Int -> Maybe Evaluation -> Text formatTruncatedScore :: Maybe Int -> Maybe Evaluation -> Text

View File

@ -419,7 +419,7 @@ checkOrInsertEvaluation repoDir chan out = do
maybeEvaluation <- runDB $ getBy $ UniqueEvaluationTestChecksum (outTest out) (outChecksum out) maybeEvaluation <- runDB $ getBy $ UniqueEvaluationTestChecksum (outTest out) (outChecksum out)
case maybeEvaluation of case maybeEvaluation of
Just (Entity _ evaluation) -> do 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 Nothing -> do
msg chan $ "Start evaluation..." msg chan $ "Start evaluation..."
challengeDir <- getRepoDir $ challengePrivateRepo challenge challengeDir <- getRepoDir $ challengePrivateRepo challenge
@ -429,7 +429,7 @@ checkOrInsertEvaluation repoDir chan out = do
Right (Left _) -> do Right (Left _) -> do
err chan "Cannot parse options, check the challenge repo" err chan "Cannot parse options, check the challenge repo"
Right (Right (_, Just [(_, [result])])) -> do Right (Right (_, Just [(_, [result])])) -> do
msg chan $ concat [ "Evaluated! Score ", (T.pack $ show result) ] msg chan $ concat [ "Evaluated! Score ", (formatNonScientifically result) ]
time <- liftIO getCurrentTime time <- liftIO getCurrentTime
_ <- runDB $ insert $ Evaluation { _ <- runDB $ insert $ Evaluation {
evaluationTest=outTest out, evaluationTest=outTest out,