summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Omni/Agent/Log.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/Omni/Agent/Log.hs b/Omni/Agent/Log.hs
index 2942563..e0e05a1 100644
--- a/Omni/Agent/Log.hs
+++ b/Omni/Agent/Log.hs
@@ -16,6 +16,7 @@ import qualified Data.Text.IO as TIO
import qualified System.Console.ANSI as ANSI
import qualified System.IO as IO
import System.IO.Unsafe (unsafePerformIO)
+import Text.Printf (printf)
-- | Status of the agent for the UI
data Status = Status
@@ -113,7 +114,8 @@ render = do
ANSI.hCursorDown IO.stderr 1
ANSI.hSetCursorColumn IO.stderr 0
ANSI.hClearLine IO.stderr
- TIO.hPutStr IO.stderr ("Files: " <> tshow statusFiles <> " | Credits: $" <> tshow statusCredits)
+ let creditsStr = Text.pack (printf "%.2f" statusCredits)
+ TIO.hPutStr IO.stderr ("Files: " <> tshow statusFiles <> " | Credits: $" <> creditsStr)
-- Line 4: Time
ANSI.hCursorDown IO.stderr 1
@@ -166,7 +168,7 @@ updateFromEntry :: LogEntry -> Status -> Status
updateFromEntry LogEntry {..} s =
s
{ statusThread = leThreadId <|> statusThread s,
- statusCredits = maybe (statusCredits s) (/ 100.0) (leTotalCredits <|> leCredits),
+ statusCredits = maybe (statusCredits s) (/ 100.0) leTotalCredits, -- Only update if totalCredits is present
statusTime = maybe (statusTime s) formatTime leTimestamp
}