1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-24 17:51:14 +02:00

Make the creation archive stats widget do the same thing and handle NaNs

This commit is contained in:
Thomas Heartman 2025-08-29 10:59:14 +02:00
parent 37533e334b
commit 7f83ea730f
No known key found for this signature in database
GPG Key ID: BD1F880DAED1EE78
2 changed files with 4 additions and 7 deletions

View File

@ -50,10 +50,8 @@ export const CreationArchiveRatioTooltip: FC<
const archivedCount = rawData.archivedFlags || 0;
const createdCount = rawData.totalCreatedFlags || 0;
const ratio = Math.min(
Math.round((archivedCount / createdCount) * 100),
100,
);
const rawRatio = Math.round((archivedCount / createdCount) * 100);
const ratio = Number.isNaN(rawRatio) ? 100 : Math.min(rawRatio, 100);
return (
<ChartTooltipContainer tooltip={tooltip}>

View File

@ -34,9 +34,8 @@ function getCurrentArchiveRatio(
}
});
return totalCreated > 0
? Math.round((totalArchived / totalCreated) * 100)
: 0;
const rawRatio = Math.round((totalArchived / totalCreated) * 100);
return Number.isNaN(rawRatio) ? 100 : Math.min(rawRatio, 100);
}
const StyledRatioContainer = styled(Box)(({ theme }) => ({