File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -632,11 +632,23 @@ func (m model) handleStatsDayData(msg statsDayDataMsg) (tea.Model, tea.Cmd) {
632632 }
633633 }
634634
635- // Add upcoming matches (only from today)
635+ // Add upcoming matches (only from today), deduplicated by match ID
636636 if msg .isToday && len (msg .upcoming ) > 0 {
637- m .statsData .TodayUpcoming = append (m .statsData .TodayUpcoming , msg .upcoming ... )
637+ // Build a set of existing IDs to avoid duplicates
638+ existingIDs := make (map [int ]bool )
639+ for _ , match := range m .statsData .TodayUpcoming {
640+ existingIDs [match .ID ] = true
641+ }
642+
643+ // Only add matches that aren't already in the list
644+ for _ , match := range msg .upcoming {
645+ if ! existingIDs [match .ID ] {
646+ m .statsData .TodayUpcoming = append (m .statsData .TodayUpcoming , match )
647+ existingIDs [match .ID ] = true
648+ }
649+ }
638650
639- // Also populate liveUpcomingMatches for the live view
651+ // Populate liveUpcomingMatches for the live view
640652 upcomingDisplay := make ([]ui.MatchDisplay , 0 , len (m .statsData .TodayUpcoming ))
641653 for _ , match := range m .statsData .TodayUpcoming {
642654 upcomingDisplay = append (upcomingDisplay , ui.MatchDisplay {Match : match })
You can’t perform that action at this time.
0 commit comments