added periods played
This commit is contained in:
@@ -381,16 +381,17 @@ func GetFinalizedResultsForFixtures(ctx context.Context, tx bun.Tx, fixtureIDs [
|
|||||||
|
|
||||||
// AggregatedPlayerStats holds summed stats for a player across multiple fixtures.
|
// AggregatedPlayerStats holds summed stats for a player across multiple fixtures.
|
||||||
type AggregatedPlayerStats struct {
|
type AggregatedPlayerStats struct {
|
||||||
PlayerID int `bun:"player_id"`
|
PlayerID int `bun:"player_id"`
|
||||||
PlayerName string `bun:"player_name"`
|
PlayerName string `bun:"player_name"`
|
||||||
GamesPlayed int `bun:"games_played"`
|
GamesPlayed int `bun:"games_played"`
|
||||||
Score int `bun:"total_score"`
|
PeriodsPlayed int `bun:"total_periods_played"`
|
||||||
Goals int `bun:"total_goals"`
|
Score int `bun:"total_score"`
|
||||||
Assists int `bun:"total_assists"`
|
Goals int `bun:"total_goals"`
|
||||||
Saves int `bun:"total_saves"`
|
Assists int `bun:"total_assists"`
|
||||||
Shots int `bun:"total_shots"`
|
Saves int `bun:"total_saves"`
|
||||||
Blocks int `bun:"total_blocks"`
|
Shots int `bun:"total_shots"`
|
||||||
Passes int `bun:"total_passes"`
|
Blocks int `bun:"total_blocks"`
|
||||||
|
Passes int `bun:"total_passes"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAggregatedPlayerStatsForTeam returns aggregated period-3 stats for all mapped
|
// GetAggregatedPlayerStatsForTeam returns aggregated period-3 stats for all mapped
|
||||||
@@ -411,6 +412,7 @@ func GetAggregatedPlayerStatsForTeam(
|
|||||||
frps.player_id AS player_id,
|
frps.player_id AS player_id,
|
||||||
COALESCE(p.name, frps.player_username) AS player_name,
|
COALESCE(p.name, frps.player_username) AS player_name,
|
||||||
COUNT(DISTINCT frps.fixture_result_id) AS games_played,
|
COUNT(DISTINCT frps.fixture_result_id) AS games_played,
|
||||||
|
COALESCE(SUM(frps.periods_played), 0) AS total_periods_played,
|
||||||
COALESCE(SUM(frps.score), 0) AS total_score,
|
COALESCE(SUM(frps.score), 0) AS total_score,
|
||||||
COALESCE(SUM(frps.goals), 0) AS total_goals,
|
COALESCE(SUM(frps.goals), 0) AS total_goals,
|
||||||
COALESCE(SUM(frps.assists), 0) AS total_assists,
|
COALESCE(SUM(frps.assists), 0) AS total_assists,
|
||||||
|
|||||||
@@ -662,6 +662,7 @@ templ fixtureTeamSection(team *db.Team, players []*db.PlayerWithPlayStatus, side
|
|||||||
<thead class="bg-surface0 border-b border-surface1">
|
<thead class="bg-surface0 border-b border-surface1">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="px-3 py-2 text-left text-xs font-semibold text-text">Player</th>
|
<th class="px-3 py-2 text-left text-xs font-semibold text-text">Player</th>
|
||||||
|
<th class="px-2 py-2 text-center text-xs font-semibold text-text" title="Periods Played">PP</th>
|
||||||
<th class="px-2 py-2 text-center text-xs font-semibold text-text" title="Score">SC</th>
|
<th class="px-2 py-2 text-center text-xs font-semibold text-text" title="Score">SC</th>
|
||||||
<th class="px-2 py-2 text-center text-xs font-semibold text-text" title="Goals">G</th>
|
<th class="px-2 py-2 text-center text-xs font-semibold text-text" title="Goals">G</th>
|
||||||
<th class="px-2 py-2 text-center text-xs font-semibold text-text" title="Assists">A</th>
|
<th class="px-2 py-2 text-center text-xs font-semibold text-text" title="Assists">A</th>
|
||||||
@@ -690,6 +691,7 @@ templ fixtureTeamSection(team *db.Team, players []*db.PlayerWithPlayStatus, side
|
|||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
if p.Stats != nil {
|
if p.Stats != nil {
|
||||||
|
<td class="px-2 py-2 text-center text-sm text-subtext0">{ intPtrStr(p.Stats.PeriodsPlayed) }</td>
|
||||||
<td class="px-2 py-2 text-center text-sm font-medium text-text">{ intPtrStr(p.Stats.Score) }</td>
|
<td class="px-2 py-2 text-center text-sm font-medium text-text">{ intPtrStr(p.Stats.Score) }</td>
|
||||||
<td class="px-2 py-2 text-center text-sm text-text">{ intPtrStr(p.Stats.Goals) }</td>
|
<td class="px-2 py-2 text-center text-sm text-text">{ intPtrStr(p.Stats.Goals) }</td>
|
||||||
<td class="px-2 py-2 text-center text-sm text-text">{ intPtrStr(p.Stats.Assists) }</td>
|
<td class="px-2 py-2 text-center text-sm text-text">{ intPtrStr(p.Stats.Assists) }</td>
|
||||||
@@ -698,7 +700,7 @@ templ fixtureTeamSection(team *db.Team, players []*db.PlayerWithPlayStatus, side
|
|||||||
<td class="px-2 py-2 text-center text-sm text-text">{ intPtrStr(p.Stats.Blocks) }</td>
|
<td class="px-2 py-2 text-center text-sm text-text">{ intPtrStr(p.Stats.Blocks) }</td>
|
||||||
<td class="px-2 py-2 text-center text-sm text-text">{ intPtrStr(p.Stats.Passes) }</td>
|
<td class="px-2 py-2 text-center text-sm text-text">{ intPtrStr(p.Stats.Passes) }</td>
|
||||||
} else {
|
} else {
|
||||||
<td colspan="7" class="px-2 py-2 text-center text-xs text-subtext1">—</td>
|
<td colspan="8" class="px-2 py-2 text-center text-xs text-subtext1">—</td>
|
||||||
}
|
}
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -205,6 +205,7 @@ templ reviewTeamStats(team *db.Team, result *db.FixtureResult, side string) {
|
|||||||
<thead class="bg-surface0 border-b border-surface1">
|
<thead class="bg-surface0 border-b border-surface1">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="px-3 py-2 text-left text-xs font-semibold text-text">Player</th>
|
<th class="px-3 py-2 text-left text-xs font-semibold text-text">Player</th>
|
||||||
|
<th class="px-2 py-2 text-center text-xs font-semibold text-text" title="Periods Played">PP</th>
|
||||||
<th class="px-2 py-2 text-center text-xs font-semibold text-text" title="Goals">G</th>
|
<th class="px-2 py-2 text-center text-xs font-semibold text-text" title="Goals">G</th>
|
||||||
<th class="px-2 py-2 text-center text-xs font-semibold text-text" title="Assists">A</th>
|
<th class="px-2 py-2 text-center text-xs font-semibold text-text" title="Assists">A</th>
|
||||||
<th class="px-2 py-2 text-center text-xs font-semibold text-text" title="Saves">SV</th>
|
<th class="px-2 py-2 text-center text-xs font-semibold text-text" title="Saves">SV</th>
|
||||||
@@ -230,6 +231,7 @@ templ reviewTeamStats(team *db.Team, result *db.FixtureResult, side string) {
|
|||||||
}
|
}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
|
<td class="px-2 py-2 text-center text-sm text-subtext0">{ intPtrStr(ps.Stats.PeriodsPlayed) }</td>
|
||||||
<td class="px-2 py-2 text-center text-sm text-text">{ intPtrStr(ps.Stats.Goals) }</td>
|
<td class="px-2 py-2 text-center text-sm text-text">{ intPtrStr(ps.Stats.Goals) }</td>
|
||||||
<td class="px-2 py-2 text-center text-sm text-text">{ intPtrStr(ps.Stats.Assists) }</td>
|
<td class="px-2 py-2 text-center text-sm text-text">{ intPtrStr(ps.Stats.Assists) }</td>
|
||||||
<td class="px-2 py-2 text-center text-sm text-text">{ intPtrStr(ps.Stats.Saves) }</td>
|
<td class="px-2 py-2 text-center text-sm text-text">{ intPtrStr(ps.Stats.Saves) }</td>
|
||||||
@@ -241,7 +243,7 @@ templ reviewTeamStats(team *db.Team, result *db.FixtureResult, side string) {
|
|||||||
}
|
}
|
||||||
if len(finalStats) == 0 {
|
if len(finalStats) == 0 {
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="8" class="px-3 py-4 text-center text-sm text-subtext1">
|
<td colspan="9" class="px-3 py-4 text-center text-sm text-subtext1">
|
||||||
No player stats recorded
|
No player stats recorded
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -617,6 +617,7 @@ templ teamStatsSection(record *db.TeamRecord, playerStats []*db.AggregatedPlayer
|
|||||||
<tr>
|
<tr>
|
||||||
<th class="px-3 py-2 text-left text-xs font-semibold text-text">Player</th>
|
<th class="px-3 py-2 text-left text-xs font-semibold text-text">Player</th>
|
||||||
<th class="px-2 py-2 text-center text-xs font-semibold text-text" title="Games Played">GP</th>
|
<th class="px-2 py-2 text-center text-xs font-semibold text-text" title="Games Played">GP</th>
|
||||||
|
<th class="px-2 py-2 text-center text-xs font-semibold text-text" title="Periods Played">PP</th>
|
||||||
<th class="px-2 py-2 text-center text-xs font-semibold text-text" title="Score">SC</th>
|
<th class="px-2 py-2 text-center text-xs font-semibold text-text" title="Score">SC</th>
|
||||||
<th class="px-2 py-2 text-center text-xs font-semibold text-text" title="Goals">G</th>
|
<th class="px-2 py-2 text-center text-xs font-semibold text-text" title="Goals">G</th>
|
||||||
<th class="px-2 py-2 text-center text-xs font-semibold text-text" title="Assists">A</th>
|
<th class="px-2 py-2 text-center text-xs font-semibold text-text" title="Assists">A</th>
|
||||||
@@ -631,6 +632,7 @@ templ teamStatsSection(record *db.TeamRecord, playerStats []*db.AggregatedPlayer
|
|||||||
<tr class="hover:bg-surface1 transition-colors">
|
<tr class="hover:bg-surface1 transition-colors">
|
||||||
<td class="px-3 py-2 text-sm text-text">{ ps.PlayerName }</td>
|
<td class="px-3 py-2 text-sm text-text">{ ps.PlayerName }</td>
|
||||||
<td class="px-2 py-2 text-center text-sm text-subtext0">{ fmt.Sprint(ps.GamesPlayed) }</td>
|
<td class="px-2 py-2 text-center text-sm text-subtext0">{ fmt.Sprint(ps.GamesPlayed) }</td>
|
||||||
|
<td class="px-2 py-2 text-center text-sm text-subtext0">{ fmt.Sprint(ps.PeriodsPlayed) }</td>
|
||||||
<td class="px-2 py-2 text-center text-sm font-medium text-text">{ fmt.Sprint(ps.Score) }</td>
|
<td class="px-2 py-2 text-center text-sm font-medium text-text">{ fmt.Sprint(ps.Score) }</td>
|
||||||
<td class="px-2 py-2 text-center text-sm text-text">{ fmt.Sprint(ps.Goals) }</td>
|
<td class="px-2 py-2 text-center text-sm text-text">{ fmt.Sprint(ps.Goals) }</td>
|
||||||
<td class="px-2 py-2 text-center text-sm text-text">{ fmt.Sprint(ps.Assists) }</td>
|
<td class="px-2 py-2 text-center text-sm text-text">{ fmt.Sprint(ps.Assists) }</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user