diff --git a/packages/ui/src/lib/quota/utils.ts b/packages/ui/src/lib/quota/utils.ts index 14c13a54..484ad127 100644 --- a/packages/ui/src/lib/quota/utils.ts +++ b/packages/ui/src/lib/quota/utils.ts @@ -6,11 +6,10 @@ export const clampPercent = (value: number | null): number | null => { }; export const formatPercent = (value: number | null): string => { - const clamped = clampPercent(value); - if (clamped === null) { + if (typeof value !== 'number' || Number.isNaN(value)) { return '-'; } - return `${clamped}%`; + return `${Math.round(value)}%`; }; export const resolveUsageTone = (percent: number | null): 'safe' | 'warn' | 'critical' => { diff --git a/packages/web/server/lib/quota/providers/copilot.js b/packages/web/server/lib/quota/providers/copilot.js index c3ebfe61..9df7b3d2 100644 --- a/packages/web/server/lib/quota/providers/copilot.js +++ b/packages/web/server/lib/quota/providers/copilot.js @@ -18,7 +18,7 @@ const buildCopilotWindows = (payload) => { const entitlement = toNumber(snapshot.entitlement); const remaining = toNumber(snapshot.remaining); const usedPercent = entitlement && remaining !== null - ? Math.max(0, Math.min(100, 100 - (remaining / entitlement) * 100)) + ? Math.max(0, 100 - (remaining / entitlement) * 100) : null; const valueLabel = entitlement !== null && remaining !== null ? `${remaining.toFixed(0)} / ${entitlement.toFixed(0)} left`