fix(quota): show actual overusage percentage for GitHub Copilot (#805)
Remove the Math.min(100, ...) clamp on usedPercent in the Copilot quota provider so overusage flows through as the real value (e.g. 353%). Update formatPercent to display values above 100% instead of clamping, matching what the GitHub Copilot settings page reports. The progress bar remains capped at 100% width via its own independent clampPercent call, so only the label text is affected. Co-authored-by: Ariel Sandor <39200214+arielsandor@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
co-authored by
Ariel Sandor
parent
598e28462a
commit
1f21ab0886
@@ -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' => {
|
||||
|
||||
@@ -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`
|
||||
|
||||
Reference in New Issue
Block a user