Openstatus www.openstatus.dev
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: delta badge rounding (#669)

authored by

Maximilian Kaske and committed by
GitHub
5d082433 611c55e1

+2 -2
+2 -2
apps/web/src/app/app/[workspaceSlug]/(dashboard)/monitors/[id]/_components/metrics-card.tsx
··· 99 99 100 100 function DeltaBadge({ 101 101 value, 102 - decimal = 3, 102 + decimal = 1, 103 103 }: { 104 104 value: number; 105 105 decimal?: number; 106 106 }) { 107 107 const round = Math.pow(10, decimal); // 10^1 = 10 (1 decimal), 10^2 = 100 (2 decimals), etc. 108 - const percentage = (Math.round((value - 1) * round) / round) * 100; 108 + const percentage = Math.round((value - 1) * 100 * round) / round; 109 109 110 110 const variant: VariantProps<typeof badgeVariants>["variant"] = 111 111 percentage > 0 ? "increase" : percentage < 0 ? "decrease" : "default";