Skip to content

Commit c404c01

Browse files
committed
ack PR comments
1 parent 92e0185 commit c404c01

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

apps/sim/lib/billing/core/billing.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ export async function getSimplifiedBillingSummary(
310310
const totalLastPeriodCopilotCost = toNumber(totalLastPeriodCopilotCostDecimal)
311311

312312
// Calculate team-level overage: total usage beyond what was already paid to Stripe
313-
const totalOverage = Math.max(0, totalCurrentUsage - totalBasePrice)
313+
const totalOverage = toNumber(Decimal.max(0, totalCurrentUsageDecimal.minus(totalBasePrice)))
314314

315315
// Get user's personal limits for warnings
316316
const percentUsed =
@@ -435,7 +435,7 @@ export async function getSimplifiedBillingSummary(
435435
totalLastPeriodCopilotCost = toNumber(totalTeamLastPeriodCopilotCostDecimal)
436436
}
437437

438-
const overageAmount = Math.max(0, currentUsage - basePrice)
438+
const overageAmount = toNumber(Decimal.max(0, toDecimal(currentUsage).minus(basePrice)))
439439
const percentUsed = usageData.limit > 0 ? (currentUsage / usageData.limit) * 100 : 0
440440

441441
// Calculate days remaining in billing period

0 commit comments

Comments
 (0)