feat(dashboard): add GET /api/dashboard/kpis endpoint and integrate into frontend
Deploy Development / deploy (push) Successful in 40s
Test Suite / pytest-backend (push) Successful in 35s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 12s
Test Suite / playwright-tests (push) Successful in 1m32s

- Implemented a new API endpoint for retrieving dashboard KPIs, providing a consolidated overview of drafts, personal exercises, and year-to-date completed units.
- Updated the Dashboard component to utilize the new endpoint, enhancing data retrieval efficiency and user experience.
- Added a helper function in the exercises router for programmatic access to exercise listings.
- Updated versioning and changelog to reflect the addition of the dashboard feature.
This commit is contained in:
Lars committed 2026-05-14 07:47:27 +02:00
1 parent ebad8025f4
commit 597486bef1
9 files changed
+171 -36

No files matched your search

+7 -4
View File
@@ -144,14 +144,15 @@ test('7. Session-Persistenz nach Reload', async ({ page }) => {
});
/**
* Refaktor Phase 1 (Dashboard): kein zweites GET /api/profiles/me; genau drei GET /api/training-units.
* Refaktor Phase 2 (Dashboard): Kurzüberblick per GET /api/dashboard/kpis; genau zwei GET /api/training-units (Übersicht).
* Production-ähnlicher Build empfohlen (kein React StrictMode-Doppel-Mount im lokalen Vite-Dev).
*/
test('8. Dashboard API-Budget nach Reload (profiles/me, training-units)', async ({ page }) => {
test('8. Dashboard API-Budget nach Reload (profiles/me, training-units, dashboard/kpis)', async ({ page }) => {
await login(page);
let profilesMe = 0;
let trainingUnits = 0;
let dashboardKpis = 0;
const onRequest = (request) => {
if (request.method() !== 'GET') return;
@@ -163,6 +164,7 @@ test('8. Dashboard API-Budget nach Reload (profiles/me, training-units)', async
}
if (pathname === '/api/profiles/me') profilesMe += 1;
if (pathname === '/api/training-units') trainingUnits += 1;
if (pathname === '/api/dashboard/kpis') dashboardKpis += 1;
};
page.on('request', onRequest);
@@ -180,12 +182,13 @@ test('8. Dashboard API-Budget nach Reload (profiles/me, training-units)', async
});
expect(profilesMe).toBe(1);
expect(trainingUnits).toBe(3);
expect(trainingUnits).toBe(2);
expect(dashboardKpis).toBe(1);
} finally {
page.off('request', onRequest);
}
console.log('✓ Dashboard API-Budget: 1× profiles/me, 3× training-units');
console.log('✓ Dashboard API-Budget: 1× profiles/me, 2× training-units, 1× dashboard/kpis');
});
test('P-12: sessionStorage wird bei Logout bereinigt (sj_coach_* Schlüssel)', async ({ page }) => {