From 3d523b138756394bfc32866385b42704792e0d9e Mon Sep 17 00:00:00 2001 From: Simon Shi Date: Sat, 23 May 2026 23:42:05 +0900 Subject: [PATCH] =?UTF-8?q?fix(qoder):=20drop=20`remaining`=20from=20norma?= =?UTF-8?q?lized=20quota=20=E2=80=94=20was=20rendering=20as=20%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Qoder's API returns `remaining` as an absolute credit count (e.g. 348 out of 3000), but ProviderLimits' getRemainingPercentage and QuotaTable treat the `remaining` field as a 0-100 percentage. Result: "348%" with red status. Stop forwarding `remaining` from the qoder parser. The percentage is computed from used/total via calculatePercentage, which gives the correct ~12% remaining for the example case. --- .../dashboard/usage/components/ProviderLimits/utils.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/utils.js b/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/utils.js index 0e916d4d..24e9f875 100644 --- a/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/utils.js +++ b/src/app/(dashboard)/dashboard/usage/components/ProviderLimits/utils.js @@ -165,6 +165,10 @@ export function parseQuotaData(provider, data) { // quota, both with same shape: {total, used, remaining, unit, resetAt}. // Skip an organization bucket when its total is 0 — most personal // Qoder accounts won't have one and rendering "0/0" is misleading. + // Don't forward Qoder's `remaining` field: it's an absolute credit + // count, but getRemainingPercentage / QuotaTable interpret + // `remaining` as a 0-100 percentage and would render 348 credits + // as "348%". The percentage is computed from used/total instead. if (data.quotas) { Object.entries(data.quotas).forEach(([quotaType, quota]) => { if (quotaType === "organization" && (!quota || (Number(quota.total) || 0) === 0)) { @@ -174,7 +178,6 @@ export function parseQuotaData(provider, data) { name: quotaType === "user" ? "Personal" : quotaType === "organization" ? "Organization" : quotaType, used: quota.used || 0, total: quota.total || 0, - remaining: quota.remaining, unit: quota.unit, resetAt: quota.resetAt || null, });