added league stats
This commit is contained in:
@@ -25,6 +25,7 @@ func SeasonLeagueStatsPage(
|
||||
var topGoals []*db.LeagueTopGoalScorer
|
||||
var topAssists []*db.LeagueTopAssister
|
||||
var topSaves []*db.LeagueTopSaver
|
||||
var allStats []*db.LeaguePlayerStats
|
||||
|
||||
if ok := conn.WithReadTx(s, w, r, func(ctx context.Context, tx bun.Tx) (bool, error) {
|
||||
var err error
|
||||
@@ -52,15 +53,20 @@ func SeasonLeagueStatsPage(
|
||||
return false, errors.Wrap(err, "db.GetTopSavers")
|
||||
}
|
||||
|
||||
allStats, err = db.GetAllLeaguePlayerStats(ctx, tx, sl.SeasonID, sl.LeagueID)
|
||||
if err != nil {
|
||||
return false, errors.Wrap(err, "db.GetAllLeaguePlayerStats")
|
||||
}
|
||||
|
||||
return true, nil
|
||||
}); !ok {
|
||||
return
|
||||
}
|
||||
|
||||
if r.Method == "GET" {
|
||||
renderSafely(seasonsview.SeasonLeagueStatsPage(sl.Season, sl.League, topGoals, topAssists, topSaves), s, r, w)
|
||||
renderSafely(seasonsview.SeasonLeagueStatsPage(sl.Season, sl.League, topGoals, topAssists, topSaves, allStats), s, r, w)
|
||||
} else {
|
||||
renderSafely(seasonsview.SeasonLeagueStats(sl.Season, sl.League, topGoals, topAssists, topSaves), s, r, w)
|
||||
renderSafely(seasonsview.SeasonLeagueStats(sl.Season, sl.League, topGoals, topAssists, topSaves, allStats), s, r, w)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user