diff --git a/backend/routes/sessions.js b/backend/routes/sessions.js index fed226b..bc70cd3 100644 --- a/backend/routes/sessions.js +++ b/backend/routes/sessions.js @@ -67,7 +67,10 @@ router.get('/', (req, res) => { return { ...session, has_notes, notes_preview }; }); + const absoluteTotal = db.prepare('SELECT COUNT(*) as total FROM sessions').get(); + res.set('X-Total-Count', String(countRow.total)); + res.set('X-Absolute-Total', String(absoluteTotal.total)); res.json(result); } catch (error) { res.status(500).json({ error: error.message }); diff --git a/frontend/src/pages/History.jsx b/frontend/src/pages/History.jsx index d81256f..7d8b8dc 100644 --- a/frontend/src/pages/History.jsx +++ b/frontend/src/pages/History.jsx @@ -14,6 +14,7 @@ function History() { const [sessions, setSessions] = useState([]); const [loading, setLoading] = useState(true); const [totalCount, setTotalCount] = useState(0); + const [absoluteTotal, setAbsoluteTotal] = useState(0); const [closingSession, setClosingSession] = useState(null); const [filter, setFilter] = useState(() => localStorage.getItem(prefixKey(adminName, 'history-filter')) || 'default'); @@ -33,6 +34,7 @@ function History() { }); setSessions(response.data); setTotalCount(parseInt(response.headers['x-total-count'] || '0', 10)); + setAbsoluteTotal(parseInt(response.headers['x-absolute-total'] || '0', 10)); } catch (err) { console.error('Failed to load sessions', err); } finally { @@ -179,7 +181,10 @@ function History() {
- {totalCount} session{totalCount !== 1 ? 's' : ''} total + {sessions.length === absoluteTotal + ? `${absoluteTotal} session${absoluteTotal !== 1 ? 's' : ''} total` + : `${sessions.length} visible (${absoluteTotal} total)` + } {isAuthenticated && (