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