From b0bb3556b3010064df676cd3a1c0c444243f2d4d Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Mon, 18 Nov 2024 11:48:25 +0000 Subject: [PATCH] Round confidence value before use --- src/components/ActionCertaintyCard.tsx | 4 +++- src/components/PercentageDisplay.tsx | 2 +- src/components/PercentageMeter.tsx | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/ActionCertaintyCard.tsx b/src/components/ActionCertaintyCard.tsx index 7292f5911..7b11637bc 100644 --- a/src/components/ActionCertaintyCard.tsx +++ b/src/components/ActionCertaintyCard.tsx @@ -47,7 +47,9 @@ const ActionCertaintyCard = ({ [onThresholdChange] ); const sliderValue = requiredConfidence * 100; - const currentConfidence = predictionResult?.confidences[actionId] ?? 0; + const currentConfidence = Math.round( + (predictionResult?.confidences[actionId] ?? 0) * 100 + ); return ( {`${Math.round(value * 100)}%`} + >{`${value}%`} ); }; diff --git a/src/components/PercentageMeter.tsx b/src/components/PercentageMeter.tsx index aeae6b3a0..f1ba54b8f 100644 --- a/src/components/PercentageMeter.tsx +++ b/src/components/PercentageMeter.tsx @@ -26,7 +26,7 @@ const PercentageMeter = ({ // Use inline style attribute to avoid style tags being // constantly appended to the element. style={{ - width: `${Math.round(value * 100)}%`, + width: `${value}%`, }} h={height} rounded="full"