added match preview and analysis

This commit is contained in:
2026-03-06 22:08:41 +11:00
parent b957df8d32
commit f5c9e70edf
6 changed files with 1473 additions and 8 deletions

View File

@@ -47,6 +47,7 @@ func FixtureDetailPage(
var rosters map[string][]*db.PlayerWithPlayStatus
var nominatedFreeAgents []*db.FixtureFreeAgent
var availableFreeAgents []*db.SeasonLeagueFreeAgent
var previewData *db.MatchPreviewData
if ok := conn.WithReadTx(s, w, r, func(ctx context.Context, tx bun.Tx) (bool, error) {
var err error
@@ -94,6 +95,15 @@ func FixtureDetailPage(
return false, errors.Wrap(err, "db.GetFreeAgentsForSeasonLeague")
}
}
// Fetch match preview data for preview and analysis tabs
if activeTab == "preview" || activeTab == "analysis" {
previewData, err = db.ComputeMatchPreview(ctx, tx, fixture)
if err != nil {
return false, errors.Wrap(err, "db.ComputeMatchPreview")
}
}
return true, nil
}); !ok {
return
@@ -102,6 +112,7 @@ func FixtureDetailPage(
renderSafely(seasonsview.FixtureDetailPage(
fixture, currentSchedule, history, canSchedule, userTeamID,
result, rosters, activeTab, nominatedFreeAgents, availableFreeAgents,
previewData,
), s, r, w)
})
}