diff --git a/frontend/src/pages/OpsIngestion.tsx b/frontend/src/pages/OpsIngestion.tsx index b32e6fc..002ef2d 100644 --- a/frontend/src/pages/OpsIngestion.tsx +++ b/frontend/src/pages/OpsIngestion.tsx @@ -11,15 +11,22 @@ export function OpsIngestionPage() { if (tpLoading) return ; - const chartData = (throughput ?? []).map((row: unknown) => { - const r = row as Record; - return { - time: r.bucket_start ? new Date(r.bucket_start as string).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) : '', - completed: Number(r.completed ?? 0), - failed: Number(r.failed ?? 0), - items: Number(r.items_fetched ?? 0), - }; - }); + const chartData = (() => { + const buckets = new Map(); + for (const row of throughput ?? []) { + const r = row as Record; + const time = r.bucket_start + ? new Date(r.bucket_start as string).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) + : ''; + if (!time) continue; + const existing = buckets.get(time) ?? { time, completed: 0, failed: 0, items: 0 }; + existing.completed += Number(r.completed ?? 0); + existing.failed += Number(r.failed ?? 0); + existing.items += Number(r.items_fetched ?? 0); + buckets.set(time, existing); + } + return Array.from(buckets.values()); + })(); const s = (summary ?? {}) as Record;