Fix formatting results in announcements

This commit is contained in:
Filip Gralinski 2021-08-21 11:57:39 +02:00
parent 041e39b676
commit e93c09c5b8

View File

@ -51,6 +51,8 @@ import qualified Text.Read as TR
import GEval.Core import GEval.Core
import GEval.EvaluationScheme import GEval.EvaluationScheme
import GEval.Formatting
import GEval.Common (MetricResult(..))
import PersistSHA1 import PersistSHA1
@ -955,6 +957,8 @@ doCreateSubmission' _ userId challengeId challengeSubmissionData chan = do
do do
let challengeLink = linkInAnnouncement mHook app (challengeTitle challenge) ("challenge/" let challengeLink = linkInAnnouncement mHook app (challengeTitle challenge) ("challenge/"
++ (challengeName challenge)) ++ (challengeName challenge))
let formattingOpts = getTestFormattingOpts mainTest
let message = ("Whoa! New best result for " let message = ("Whoa! New best result for "
++ challengeLink ++ challengeLink
++ " challenge by " ++ " challenge by "
@ -962,12 +966,12 @@ doCreateSubmission' _ userId challengeId challengeSubmissionData chan = do
++ ", " ++ ", "
++ (T.pack $ show $ testMetric mainTest) ++ (T.pack $ show $ testMetric mainTest)
++ ": " ++ ": "
++ (formatScore (testPrecision mainTest) s) ++ (T.pack $ formatTheResult formattingOpts (SimpleRun s))
++ " (" ++ " ("
++ (if s > b ++ (if s > b
then "+" then "+"
else "") else "")
++ (formatScore (testPrecision mainTest) (s-b)) ++ (T.pack $ formatTheResult formattingOpts (SimpleRun (s-b)))
++ ")." ++ ")."
++ " See " ++ submissionLink ++ "." ++ " See " ++ submissionLink ++ "."
++ " :clap:") ++ " :clap:")