diff --git a/CLAUDE.md b/CLAUDE.md index 5b9e40d..3d52871 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -845,8 +845,8 @@ For ActivityPub federated posts and thumbnails: - [x] Weather display on activity detail page (temperature, humidity, wind, pressure, precipitation) ### Phase 4: Enhanced Federation -- [ ] Rich preview cards for activities -- [ ] Cross-platform activity sync +- [x] Rich preview cards for activities +- [x] Cross-platform activity sync ### Phase 5: Mobile & Integrations - [ ] Progressive Web App (PWA) diff --git a/src/main/resources/templates/analytics/training-load.html b/src/main/resources/templates/analytics/training-load.html index 2b738a8..9cd819f 100644 --- a/src/main/resources/templates/analytics/training-load.html +++ b/src/main/resources/templates/analytics/training-load.html @@ -135,10 +135,13 @@ const response = await FitPubAuth.authenticatedFetch(`/api/analytics/training-load?days=${days}`); if (!response.ok) { - throw new Error('Failed to load training load data'); + const errorText = await response.text(); + console.error('API Error:', response.status, errorText); + throw new Error(`Failed to load training load data: ${response.status} ${response.statusText}`); } const data = await response.json(); + console.log('Training load data received:', data); displayCharts(data); document.getElementById('loading-spinner').style.display = 'none'; @@ -146,12 +149,25 @@ } catch (error) { console.error('Error loading training load:', error); document.getElementById('loading-spinner').style.display = 'none'; - document.getElementById('error-message').textContent = 'Failed to load training load data'; + const errorMsg = error.message || 'Failed to load training load data'; + document.getElementById('error-message').textContent = errorMsg; document.getElementById('error-message').style.display = 'block'; + document.getElementById('error-message').classList.add('alert-danger'); + document.getElementById('error-message').classList.remove('alert-info'); } } function displayCharts(data) { + // Check if data is empty + if (!data || data.length === 0) { + document.getElementById('loading-spinner').style.display = 'none'; + document.getElementById('error-message').textContent = 'No training load data available. Upload some activities to see your training metrics!'; + document.getElementById('error-message').style.display = 'block'; + document.getElementById('error-message').classList.remove('alert-danger'); + document.getElementById('error-message').classList.add('alert-info'); + return; + } + // Reverse data to show chronologically data = data.reverse(); diff --git a/src/test/java/org/operaton/fitpub/service/ActivityImageServiceTest.java b/src/test/java/org/operaton/fitpub/service/ActivityImageServiceTest.java index 5d6f7c3..7b5e5bd 100644 --- a/src/test/java/org/operaton/fitpub/service/ActivityImageServiceTest.java +++ b/src/test/java/org/operaton/fitpub/service/ActivityImageServiceTest.java @@ -52,7 +52,7 @@ class ActivityImageServiceTest { * mvn test -Dtest=ActivityImageServiceTest#testGenerateActivityImage_Manual */ @Test - //@Disabled("Manual test - run explicitly when needed") + @Disabled("Manual test - run explicitly when needed") @DisplayName("Generate activity image from test FIT file") void testGenerateActivityImage_Manual() throws Exception { // Load test FIT file