mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-07 00:44:49 +00:00
fix(usage): complete enterprise spending percentages
Derive missing remaining percentages so CLI spending output matches the Usage card. Preserve explicitly reported percentages and cover missing currency and absent rolling windows. Co-authored-by: Matt Cowger <matt@cowger.us> Co-authored-by: JasprW <wang@jaspr.me>
This commit is contained in:
co-authored by
Matt Cowger
JasprW
parent
c9b03eb309
commit
f56a1add91
@@ -243,14 +243,14 @@ export async function fetchUsage(
|
||||
const usedPct =
|
||||
limit.used_percent ??
|
||||
(limit.remaining_percent != null ? 100 - limit.remaining_percent : undefined);
|
||||
if (usedPct === undefined && limit.remaining_percent == null) return [];
|
||||
if (usedPct === undefined) return [];
|
||||
return [
|
||||
{
|
||||
id: "individual_limit",
|
||||
label: "Individual spend limit",
|
||||
summary: true,
|
||||
usedPct,
|
||||
remainingPct: limit.remaining_percent,
|
||||
remainingPct: limit.remaining_percent ?? Math.max(0, 100 - usedPct),
|
||||
resetsAt:
|
||||
limit.reset_at != null ? new Date(limit.reset_at * 1000).toISOString() : null,
|
||||
tone: toneFromUsedPct(usedPct),
|
||||
|
||||
Reference in New Issue
Block a user