Skip to content

Commit 458433c

Browse files
committed
fix: limit daily chart to last 15 days and sort sessions newest-first
Slice daily chart to the most recent 15 days to keep it readable. Reverse session sort order within each day so the latest entries appear at the top.
1 parent f0dea2b commit 458433c

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

js/components/charts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ function buildDailyChart(allSessions) {
132132
dailyBySource[s.date][s.source] = (dailyBySource[s.date][s.source] || 0) + s.cost;
133133
allSourcesSet.add(s.source);
134134
});
135-
const chartDays = Object.keys(dailyBySource).sort();
135+
const chartDays = Object.keys(dailyBySource).sort().slice(-15);
136136
const allSources = Array.from(allSourcesSet);
137137

138138
const canvas = document.getElementById('dailyChart');

js/components/sessions-table.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ export function buildDayDetail(date, sessions) {
209209
<th>Time</th><th>Source</th><th>Model</th>
210210
<th>Input</th><th>Output</th><th>Cache R</th><th>Cache W</th><th style="text-align:right">Cost</th>
211211
</tr></thead><tbody>`;
212-
sessions.sort((a, b) => (a.time || '').localeCompare(b.time || ''));
212+
sessions.sort((a, b) => (b.time || '').localeCompare(a.time || ''));
213213
for (const s of sessions) {
214214
const mi = getModelInfo(s.model);
215215
const sc = sourceClass(s.source);

0 commit comments

Comments
 (0)