added match preview and analysis
This commit is contained in:
@@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user