UI: Fix live policy response percentage rounding (#28719)

## For #27052 

- Use `round` instead of `ceil` and `floor`

<img width="144" alt="Screenshot 2025-04-30 at 10 20 09 PM"
src="https://github.com/user-attachments/assets/48a64558-6aca-4cd0-be9e-a526f9e6219d"
/>


- [x] Changes file added for user-visible changes in `changes/`
- [x] Manual QA for all new/changed functionality

---------

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
This commit is contained in:
jacobshandling 2025-05-01 10:03:23 -07:00 committed by GitHub
parent ee3872c2f5
commit 2beed5a2ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View file

@ -0,0 +1 @@
- Fix a small bug with the way live policy result percentages were being rounded

View file

@ -144,11 +144,11 @@ const PolicyResults = ({
{" "}
(Yes:{" "}
<TooltipWrapper tipContent={`${yesCt} host${yesCt !== 1 ? "s" : ""}`}>
{Math.ceil((yesCt / uiHostCounts.successful) * 100)}%
{Math.round((yesCt / uiHostCounts.successful) * 100)}%
</TooltipWrapper>
, No:{" "}
<TooltipWrapper tipContent={`${noCt} host${noCt !== 1 ? "s" : ""}`}>
{Math.floor((noCt / uiHostCounts.successful) * 100)}%
{Math.round((noCt / uiHostCounts.successful) * 100)}%
</TooltipWrapper>
)
</span>