From e7eb34d7877052527e551e0a8f19d8b07548b938 Mon Sep 17 00:00:00 2001 From: Inferencebot Date: Fri, 13 Nov 2026 21:26:27 +0000 Subject: [PATCH] charts: Money lives in one place, and the menus are concise MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Money was both a tab and a metric of Trends — two doors to one chart, which is what "not consistent" looks like from the outside. The tab is gone; the metric stays, and the nav is Members · Model usage · Trends. Period wording now matches the dashboard exactly: 30 days · 90 days · All time. Titles come from the shared module (Members · Requests · Spend · Money · Energy · Carbon), so both apps offer the same six options in the same order. --- app/coop_chart.js | 8 ++++---- app/main.py | 16 +++------------- tests/test_chart_sync.py | 2 +- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/app/coop_chart.js b/app/coop_chart.js index 7124a74..19c6622 100644 --- a/app/coop_chart.js +++ b/app/coop_chart.js @@ -276,9 +276,9 @@ const CHART_METRICS = [ { id: "members", title: "Members", kind: "line", cont: false, fmt: "count", val: r => r.members_total }, - { id: "requests", title: "Requests per day", kind: "bar", cont: false, fmt: "count", + { id: "requests", title: "Requests", kind: "bar", cont: false, fmt: "count", val: r => r.requests }, - { id: "spend", title: "Token spend per day", kind: "bar", cont: true, fmt: "money", + { id: "spend", title: "Spend", kind: "bar", cont: true, fmt: "money", val: r => r.spend_usd }, { id: "money", title: "Money", kind: "multi", cont: true, fmt: "money", aria: "Cumulative revenue, token spend and OC balance over time", @@ -287,9 +287,9 @@ { name: "Token spend", key: "spend_cum", color: "#4a6a8a" }, { name: "OC balance", key: "oc_balance", color: "#a97a2a", dotSingle: true } ] }, - { id: "energy", title: "Energy per day", kind: "bar", cont: true, fmt: "wh", + { id: "energy", title: "Energy", kind: "bar", cont: true, fmt: "wh", val: r => r.energy_wh }, - { id: "co2e", title: "Carbon per day", kind: "bar", cont: true, fmt: "g", + { id: "co2e", title: "Carbon", kind: "bar", cont: true, fmt: "g", val: r => r.co2e_g } ]; diff --git a/app/main.py b/app/main.py index e69d547..83ebfe0 100644 --- a/app/main.py +++ b/app/main.py @@ -487,14 +487,13 @@ PAGE_HTML = """ - @@ -565,8 +564,8 @@ PAGE_HTML = """ Period - - + + @@ -908,14 +907,6 @@ function clearArrows(table, sortState) { }); } -// Money: a shortcut into Trends with the money metric selected — one chart -// area, one code path, the same chart the member dashboard draws. -function showMoney() { - buildMetricButtons(); - switchView('trends'); - setTrendMetric('money'); -} - function switchView(view) { currentView = view; hideChartTip(); @@ -930,7 +921,6 @@ function switchView(view) { $('tab-members').className = 'tab-btn' + (view === 'members' ? ' active' : ''); $('tab-models').className = 'tab-btn' + (view === 'models' ? ' active' : ''); $('tab-trends').className = 'tab-btn' + (view === 'trends' ? ' active' : ''); - // Money is a metric of Trends, so its tab shows the Trends title. $('view-title').textContent = view === 'members' ? 'Members' : (view === 'models' ? 'Model usage' : 'Trends'); // Mode groups: Balance/All-time for members; Period for models; the guest // invite form belongs to the members view too. diff --git a/tests/test_chart_sync.py b/tests/test_chart_sync.py index 0fac221..a52fcd8 100644 --- a/tests/test_chart_sync.py +++ b/tests/test_chart_sync.py @@ -21,7 +21,7 @@ import sys from pathlib import Path ROOT = Path(__file__).resolve().parent.parent -CANONICAL_SHA256 = "233c39faa7b40a9827fefd21aeb5505fdfa770833de2decebc8fe8bbbaee1903" +CANONICAL_SHA256 = "d25195d5079da499d6c3788b5678b86af65d9fee8e366cfb08fd5a0201ec1a2e" SPLICE = 'PAGE_HTML = PAGE_HTML.replace("/*@@CHART_MODULE@@*/", CHART_MODULE_JS)' failures = []