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:
parent
c36d1554c7
commit
37533e334b
@ -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}>
|
||||
|
Loading…
Reference in New Issue
Block a user