everybody loves a refactor

This commit is contained in:
2026-02-15 12:27:36 +11:00
parent 27915d0047
commit 51cb987269
44 changed files with 278 additions and 234 deletions

View File

@@ -22,12 +22,15 @@ func SeasonLeaguePage(
leagueStr := r.PathValue("league_short_name")
var season *db.Season
var league *db.League
if ok := conn.WithReadTx(s, w, r, func(ctx context.Context, tx bun.Tx) (bool, error) {
var err error
season, league, _, err = db.GetSeasonLeague(ctx, tx, seasonStr, leagueStr)
season, _, _, err = db.GetSeasonLeague(ctx, tx, seasonStr, leagueStr)
if err != nil {
if db.IsBadRequest(err) {
throw.NotFound(s, w, r, r.URL.Path)
return false, nil
}
return false, errors.Wrap(err, "db.GetSeasonLeague")
}
return true, nil
@@ -35,11 +38,6 @@ func SeasonLeaguePage(
return
}
if season == nil || league == nil {
throw.NotFound(s, w, r, r.URL.Path)
return
}
defaultTab := season.GetDefaultTab()
redirectURL := fmt.Sprintf(
"/seasons/%s/leagues/%s/%s",