Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix: fixes org usage summary (#30177)

Thomas14abe0047514
diff --git a/apps/studio/components/interfaces/Organization/BillingSettings/helpers.ts b/apps/studio/components/interfaces/Organization/BillingSettings/helpers.ts
index 7d89dc35e24..63c76f35d4d 100644
--- a/apps/studio/components/interfaces/Organization/BillingSettings/helpers.ts
+++ b/apps/studio/components/interfaces/Organization/BillingSettings/helpers.ts
@@ -6,21 +6,21 @@ const pricingMetricBytes = [
PricingMetric.STORAGE_SIZE,
]
+const pricingMetricNotHrs = [
+ PricingMetric.FUNCTION_INVOCATIONS,
+ PricingMetric.LOG_DRAIN_EVENTS,
+ PricingMetric.MONTHLY_ACTIVE_USERS,
+ PricingMetric.MONTHLY_ACTIVE_SSO_USERS,
+ PricingMetric.MONTHLY_ACTIVE_THIRD_PARTY_USERS,
+ PricingMetric.REALTIME_MESSAGE_COUNT,
+ PricingMetric.REALTIME_PEAK_CONNECTIONS,
+ PricingMetric.STORAGE_IMAGES_TRANSFORMED,
+]
+
export const formatUsage = (
pricingMetric: PricingMetric,
allocation: { usage: number; hours?: number }
) => {
- if (allocation.hours) {
- return (
- allocation.usage.toLocaleString() +
- ' (' +
- Math.round(allocation.usage / allocation.hours).toLocaleString() +
- 'x' +
- allocation.hours.toLocaleString() +
- ' hours)'
- )
- }
-
if (pricingMetricBytes.includes(pricingMetric)) {
const formattedUsage = +(allocation.usage / 1e9).toFixed(2).toLocaleString()
@@ -30,6 +30,17 @@ export const formatUsage = (
} else {
return formattedUsage
}
+ }
+
+ if (allocation.hours && !pricingMetricNotHrs.includes(pricingMetric)) {
+ return (
+ allocation.usage.toLocaleString() +
+ ' (' +
+ Math.round(allocation.usage / allocation.hours).toLocaleString() +
+ 'x' +
+ allocation.hours.toLocaleString() +
+ ' hours)'
+ )
} else {
return allocation.usage.toLocaleString()
}