From e93c09c5b8d1e923b5162762be4d687d0a84899c Mon Sep 17 00:00:00 2001 From: Filip Gralinski Date: Sat, 21 Aug 2021 11:57:39 +0200 Subject: [PATCH] Fix formatting results in announcements --- Handler/ShowChallenge.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Handler/ShowChallenge.hs b/Handler/ShowChallenge.hs index c232e70..ab4c3c9 100644 --- a/Handler/ShowChallenge.hs +++ b/Handler/ShowChallenge.hs @@ -51,6 +51,8 @@ import qualified Text.Read as TR import GEval.Core import GEval.EvaluationScheme +import GEval.Formatting +import GEval.Common (MetricResult(..)) import PersistSHA1 @@ -955,6 +957,8 @@ doCreateSubmission' _ userId challengeId challengeSubmissionData chan = do do let challengeLink = linkInAnnouncement mHook app (challengeTitle challenge) ("challenge/" ++ (challengeName challenge)) + let formattingOpts = getTestFormattingOpts mainTest + let message = ("Whoa! New best result for " ++ challengeLink ++ " challenge by " @@ -962,12 +966,12 @@ doCreateSubmission' _ userId challengeId challengeSubmissionData chan = do ++ ", " ++ (T.pack $ show $ testMetric mainTest) ++ ": " - ++ (formatScore (testPrecision mainTest) s) + ++ (T.pack $ formatTheResult formattingOpts (SimpleRun s)) ++ " (" ++ (if s > b then "+" else "") - ++ (formatScore (testPrecision mainTest) (s-b)) + ++ (T.pack $ formatTheResult formattingOpts (SimpleRun (s-b))) ++ ")." ++ " See " ++ submissionLink ++ "." ++ " :clap:")