From a37cf8e2708de5e50ca5ecf246188282de8d32ae Mon Sep 17 00:00:00 2001 From: Seungpyo1007 Date: Tue, 15 Sep 2026 11:30:37 +0900 Subject: [PATCH] feat(site): plot CPU engineering samples across the growth timeline Reads the satellite repo's history.json and adds its record count as of each point's date, so it grows along the chart instead of appearing as one step at the newest point. Without history.json the chart is as before. Refs #19 --- site/src/scripts/techapi.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/site/src/scripts/techapi.js b/site/src/scripts/techapi.js index 934c6b82a115..68def9c864d5 100644 --- a/site/src/scripts/techapi.js +++ b/site/src/scripts/techapi.js @@ -444,6 +444,20 @@ function countUp(node, target, opts = {}) { if (!points || !points.length) points = await pointsFromGitHubApi(); if (!points.length) throw new Error("empty history"); + // Add each satellite's count as of every point's date (its own history.json). + const es = await fetch("https://gettechapi.github.io/cpu-engineering-samples/history.json") + .then((r) => (r.ok ? r.json() : Promise.reject())) + .then((d) => (d.points || []).map((p) => ({ t: new Date(p.date).getTime(), count: p.count }))) + .catch(() => []); + if (es.length) { + for (const point of points) { + const asOf = es.filter((p) => p.t <= point.dateValue).pop(); + if (!asOf) continue; + point.rows = [...point.rows, { key: "cpu_es", count: asOf.count }]; + point.total += asOf.count; + } + } + const currentTotal = totalRecords(currentManifest); const latest = points[points.length - 1]; if (latest.total !== currentTotal) {