Skip to content

Commit

Permalink
Round confidence value before use
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-robert committed Nov 18, 2024
1 parent a09d4dc commit b0bb355
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/components/ActionCertaintyCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Card
py={2}
Expand Down
2 changes: 1 addition & 1 deletion src/components/PercentageDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const PercentageDisplay = ({
w="60px"
aria-hidden={!!ariaLabel}
{...rest}
>{`${Math.round(value * 100)}%`}</Text>
>{`${value}%`}</Text>
</>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/PercentageMeter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const PercentageMeter = ({
// Use inline style attribute to avoid style tags being
// constantly appended to the <head/> element.
style={{
width: `${Math.round(value * 100)}%`,
width: `${value}%`,
}}
h={height}
rounded="full"
Expand Down

0 comments on commit b0bb355

Please sign in to comment.