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

fix: Show 100% instead of Infinity% if you've not created any flags

JS gives you positive infinity if you divide a positive number by 0, which isn't very helpful here. Instead, let's show 100%.
This commit is contained in:
Thomas Heartman 2025-08-29 10:45:49 +02:00
parent c36d1554c7
commit 37533e334b
No known key found for this signature in database
GPG Key ID: BD1F880DAED1EE78

View File

@ -49,7 +49,11 @@ export const CreationArchiveRatioTooltip: FC<
const rawData = tooltip.dataPoints[0].raw as WeekData;
const archivedCount = rawData.archivedFlags || 0;
const createdCount = rawData.totalCreatedFlags || 0;
const ratio = Math.round((archivedCount / createdCount) * 100);
const ratio = Math.min(
Math.round((archivedCount / createdCount) * 100),
100,
);
return (
<ChartTooltipContainer tooltip={tooltip}>