The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Fixes the NaN errors on the billing table
Terry Suttone1b26a68e552
diff --git a/studio/hooks/queries/useProjectPaygStatistics.ts b/studio/hooks/queries/useProjectPaygStatistics.tsindex 08f9d9efc9c..37b11a69ec5 100644--- a/studio/hooks/queries/useProjectPaygStatistics.ts+++ b/studio/hooks/queries/useProjectPaygStatistics.ts@@ -50,18 +50,22 @@ function getPaygStats(data: any): PaygStats {let dataModified: any = []data.map((x: any) => {- dataModified.push({ ...x, total_egress_modified: x.total_egress - x.total_storage_egress })+ dataModified.push({ ...x, total_egress_modified: x.total_egress == undefined ? 0 : x.total_egress - x.total_storage_egress == undefined ? 0 : x.total_storage_egress })})chargeableProducts.forEach((product) => {product.features.forEach((feature) => {+// calculate max- const max = _get(maxBy(dataModified, feature.attribute), feature.attribute)+ const max = _get(maxBy(dataModified, feature.attribute), feature.attribute) ?? 0+// calculate sumlet sum = 0dataModified.map((x: any) => {- sum = sum + x[feature.attribute]+ const featureAttribute = x[feature.attribute] == undefined ? 0 : x[feature.attribute]+ sum = sum + featureAttribute})+// set sum and max under attribute namepaygStats[feature.attribute] = {sum,