added teams

This commit is contained in:
2026-02-12 21:10:49 +11:00
parent ba6929629d
commit c92c722ad5
25 changed files with 1327 additions and 52 deletions

View File

@@ -19,12 +19,23 @@ func SeasonPage(
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
seasonStr := r.PathValue("season_short_name")
var season *db.Season
var leaguesWithTeams []db.LeagueWithTeams
if ok := db.WithReadTx(s, w, r, conn, func(ctx context.Context, tx bun.Tx) (bool, error) {
var err error
season, err = db.GetSeason(ctx, tx, seasonStr)
if err != nil {
return false, errors.Wrap(err, "db.GetSeason")
}
if season == nil {
return true, nil
}
leaguesWithTeams, err = season.MapTeamsToLeagues(ctx, tx)
if err != nil {
return false, errors.Wrap(err, "season.MapTeamsToLeagues")
}
return true, nil
}); !ok {
return
@@ -33,6 +44,6 @@ func SeasonPage(
throw.NotFound(s, w, r, r.URL.Path)
return
}
renderSafely(seasonsview.DetailPage(season), s, r, w)
renderSafely(seasonsview.DetailPage(season, leaguesWithTeams), s, r, w)
})
}