package seasonsview import "git.haelnorr.com/h/oslstats/internal/db" import "git.haelnorr.com/h/oslstats/internal/view/component/links" import "fmt" import "sort" import "strings" // teamAggStats holds aggregated stats for a single team in a fixture. type teamAggStats struct { Goals int Assists int PrimaryAssists int SecondaryAssists int Saves int Shots int Blocks int Passes int Turnovers int Takeaways int FaceoffsWon int FaceoffsLost int PostHits int PossessionSec int PlayersUsed int } func aggregateTeamStats(players []*db.PlayerWithPlayStatus) *teamAggStats { agg := &teamAggStats{} for _, p := range players { if !p.Played || p.Stats == nil { continue } agg.PlayersUsed++ if p.Stats.Goals != nil { agg.Goals += *p.Stats.Goals } if p.Stats.Assists != nil { agg.Assists += *p.Stats.Assists } if p.Stats.PrimaryAssists != nil { agg.PrimaryAssists += *p.Stats.PrimaryAssists } if p.Stats.SecondaryAssists != nil { agg.SecondaryAssists += *p.Stats.SecondaryAssists } if p.Stats.Saves != nil { agg.Saves += *p.Stats.Saves } if p.Stats.Shots != nil { agg.Shots += *p.Stats.Shots } if p.Stats.Blocks != nil { agg.Blocks += *p.Stats.Blocks } if p.Stats.Passes != nil { agg.Passes += *p.Stats.Passes } if p.Stats.Turnovers != nil { agg.Turnovers += *p.Stats.Turnovers } if p.Stats.Takeaways != nil { agg.Takeaways += *p.Stats.Takeaways } if p.Stats.FaceoffsWon != nil { agg.FaceoffsWon += *p.Stats.FaceoffsWon } if p.Stats.FaceoffsLost != nil { agg.FaceoffsLost += *p.Stats.FaceoffsLost } if p.Stats.PostHits != nil { agg.PostHits += *p.Stats.PostHits } if p.Stats.PossessionTimeSec != nil { agg.PossessionSec += *p.Stats.PossessionTimeSec } } return agg } func formatPossession(seconds int) string { m := seconds / 60 s := seconds % 60 return fmt.Sprintf("%d:%02d", m, s) } func faceoffPct(won, lost int) string { total := won + lost if total == 0 { return "0%" } pct := float64(won) / float64(total) * 100 return fmt.Sprintf("%.0f%%", pct) } // fixtureMatchAnalysisTab renders the full Match Analysis tab for completed fixtures. // Shows score, team stats comparison, match details, and top performers. templ fixtureMatchAnalysisTab( fixture *db.Fixture, result *db.FixtureResult, rosters map[string][]*db.PlayerWithPlayStatus, preview *db.MatchPreviewData, ) {
Both teams receive an overtime loss
} else if isOutrightForfeit { FORFEIT{ forfeitTeamName } forfeited — { winnerTeamName } wins
} if result.ForfeitReason != nil && *result.ForfeitReason != "" {Reason
{ *result.ForfeitReason }