Skip to content

Commit d2abbb1

Browse files
committed
refactor: clean up dashboard and fix Goals Trend to show full season
Dashboard Changes: - Remove 'Full Season (All Data)' tab from league filter - Remove decorative Goals Trend chart (duplicate) - Move Match Distribution chart above stats section - Change '20 teams, live data' to '20 teams, 2024 data' Goals Trend Fixes: - Backend: Show 380 matches instead of 30 (full season) - Frontend: Show 380 matches instead of 30 (full season) - This displays the complete 2024-2025 season timeline (Sep 2024 - May 2025) - Goals Trend now shows proper season-wide data instead of just May 2025 Result: Cleaner dashboard with proper full-season Goals Trend visualization
1 parent 0b3798d commit d2abbb1

3 files changed

Lines changed: 13 additions & 28 deletions

File tree

backend/api/dashboard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ async def get_chart_data(
208208
away_goals = []
209209
total_goals = []
210210

211-
for match in matches[:30]: # Last 30 matches for better chart readability
211+
for match in matches[:380]: # Full season of matches to show complete timeline
212212
# Format date as "Mon DD" for better display
213213
match_date = match.get('match_date', '')
214214
if match_date:

src/components/Dashboard.svelte

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,16 @@
520520
</div>
521521
{/if}
522522

523+
<!-- Match Distribution by Month -->
524+
{#if !loading && recentMatches.length > 0}
525+
<div class="bg-white dark:bg-slate-900 rounded-xl p-6 shadow-lg mb-6">
526+
<h3 class="text-lg font-semibold text-slate-800 dark:text-slate-200 mb-4">Match Distribution by Month</h3>
527+
<div class="h-64">
528+
<canvas bind:this={chartCanvas}></canvas>
529+
</div>
530+
</div>
531+
{/if}
532+
523533
<!-- Stats Grid - Accurate Real-Time Data -->
524534
{#if !loading && recentMatches.length > 0}
525535
<div class="grid grid-cols-2 sm:grid-cols-2 lg:grid-cols-4 gap-3 sm:gap-6">
@@ -536,7 +546,7 @@
536546
{$totalMatches.toFixed(0)}
537547
</div>
538548
<div class="text-xs text-slate-500 dark:text-slate-500 leading-tight">
539-
{totalTeams} teams, {useApiData ? 'live data' : 'cached'}
549+
{totalTeams} teams, 2024 data
540550
</div>
541551
</div>
542552

@@ -603,30 +613,6 @@
603613
</div>
604614
{/if}
605615

606-
<!-- Charts -->
607-
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
608-
<!-- Goals Trend -->
609-
<div class="bg-white dark:bg-slate-900 rounded-xl p-6 shadow-lg">
610-
<h3 class="text-lg font-semibold text-slate-800 dark:text-slate-200 mb-4">Goals Trend</h3>
611-
<div class="h-64">
612-
{#if !loading && goalsChart.labels && goalsChart.labels.length > 0}
613-
<Line data={goalsChart} options={{ responsive: true, maintainAspectRatio: false }} />
614-
{:else}
615-
<div class="flex items-center justify-center h-full text-slate-400">
616-
No data available
617-
</div>
618-
{/if}
619-
</div>
620-
</div>
621-
622-
<!-- Match Distribution by Month -->
623-
<div class="bg-white dark:bg-slate-900 rounded-xl p-6 shadow-lg">
624-
<h3 class="text-lg font-semibold text-slate-800 dark:text-slate-200 mb-4">Match Distribution by Month</h3>
625-
<div class="h-64">
626-
<canvas bind:this={chartCanvas}></canvas>
627-
</div>
628-
</div>
629-
</div>
630616
</div>
631617

632618
<style>

src/components/EnhancedVisualizations.svelte

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
7272
// League options
7373
const dateRanges = [
74-
{ value: 'all', label: 'Full Season (All Data)', icon: '🏆' },
7574
{ value: 'E0', label: 'Premier League', icon: '🏴' },
7675
{ value: 'SP1', label: 'La Liga', icon: '🇪🇸' },
7776
{ value: 'D1', label: 'Bundesliga', icon: '🇩🇪' },
@@ -323,7 +322,7 @@
323322
}
324323
325324
// Fallback to local computation
326-
const recentMatches = filteredMatches.slice(-30); // Show last 30 matches
325+
const recentMatches = filteredMatches.slice(-380); // Show full season of matches
327326
328327
// If no matches available, return empty structure
329328
if (recentMatches.length === 0) {

0 commit comments

Comments
 (0)