Skip to content

Commit 96ac700

Browse files
Round confidence value before use (#516)
1 parent 766eeb8 commit 96ac700

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/components/ActionCertaintyCard.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ const ActionCertaintyCard = ({
4747
[onThresholdChange]
4848
);
4949
const sliderValue = requiredConfidence * 100;
50-
const currentConfidence = predictionResult?.confidences[actionId] ?? 0;
50+
const currentConfidence = Math.round(
51+
(predictionResult?.confidences[actionId] ?? 0) * 100
52+
);
5153
return (
5254
<Card
5355
py={2}

src/components/PercentageDisplay.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const PercentageDisplay = ({
2626
w="60px"
2727
aria-hidden={!!ariaLabel}
2828
{...rest}
29-
>{`${Math.round(value * 100)}%`}</Text>
29+
>{`${value}%`}</Text>
3030
</>
3131
);
3232
};

src/components/PercentageMeter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const PercentageMeter = ({
2626
// Use inline style attribute to avoid style tags being
2727
// constantly appended to the <head/> element.
2828
style={{
29-
width: `${Math.round(value * 100)}%`,
29+
width: `${value}%`,
3030
}}
3131
h={height}
3232
rounded="full"

0 commit comments

Comments
 (0)