Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

handle zero usage

ErikKaumk19f92db8b62c
diff --git a/apps/docs/src/components/Dashboard/Usage.tsx b/apps/docs/src/components/Dashboard/Usage.tsx
index 4d6229403..c89c2689f 100644
--- a/apps/docs/src/components/Dashboard/Usage.tsx
+++ b/apps/docs/src/components/Dashboard/Usage.tsx
@@ -76,14 +76,18 @@ const transformData = (usages: any) => {
const ramData = usages.map((usage: any) => {
return {
x: `${String(usage.month).padStart(2, '0')}/${usage.year}`,
- y: usage.template_usage.reduce((acc: number, template: any) => acc + template.ram_gb_hours, 0),
+ y: usage.template_usage.length > 0
+ ? usage.template_usage.reduce((acc: number, template: any) => acc + template.ram_gb_hours, 0)
+ : 0,
}
})
const vpcData = usages.map((usage: any) => {
return {
x: `${String(usage.month).padStart(2, '0')}/${usage.year}`,
- y: usage.template_usage.reduce((acc: number, template: any) => acc + template.sandbox_hours, 0),
+ y: usage.template_usage.length > 0
+ ? usage.template_usage.reduce((acc: number, template: any) => acc + template.sandbox_hours, 0)
+ : 0,
}
})
@@ -103,4 +107,3 @@ const transformData = (usages: any) => {
}
}
-