package seasonsview import "git.haelnorr.com/h/oslstats/internal/db" import "git.haelnorr.com/h/oslstats/internal/view/baseview" import "fmt" templ FixtureReviewResultPage( fixture *db.Fixture, result *db.FixtureResult, unmappedPlayers []string, unnominatedFreeAgents []FreeAgentWarning, ) { {{ backURL := fmt.Sprintf("/fixtures/%d", fixture.ID) }} @baseview.Layout(fmt.Sprintf("Review Result — %s vs %s", fixture.HomeTeam.Name, fixture.AwayTeam.Name)) {

Review Match Result

{ fixture.HomeTeam.Name } vs { fixture.AwayTeam.Name } Round { fmt.Sprint(fixture.Round) }

Back to Fixture
if result.TamperingDetected || len(unmappedPlayers) > 0 || len(unnominatedFreeAgents) > 0 {
if result.TamperingDetected && result.TamperingReason != nil {
⚠ Inconsistent Data Detected

{ *result.TamperingReason }

This does not block finalization but should be reviewed carefully.

} if len(unnominatedFreeAgents) > 0 {
⚠ Free Agent Nomination Issues

The following free agents have nomination issues that should be reviewed before finalizing.

    for _, fa := range unnominatedFreeAgents {
  • { fa.Name } — { fa.Reason }
  • }
} if len(unmappedPlayers) > 0 {
⚠ Unmapped Players

The following players could not be matched to registered players. They may be free agents or have unregistered Slapshot IDs.

    for _, p := range unmappedPlayers {
  • { p }
  • }
}
}

Score

{ fixture.HomeTeam.Name }

{ fmt.Sprint(result.HomeScore) }

{ fixture.AwayTeam.Name }

{ fmt.Sprint(result.AwayScore) }

if result.Arena != "" { { result.Arena } } if result.EndReason != "" { { result.EndReason } } Winner: if result.Winner == "home" { { fixture.HomeTeam.Name } } else if result.Winner == "away" { { fixture.AwayTeam.Name } } else { Draw }
@reviewTeamStats(fixture.HomeTeam, result, "home") @reviewTeamStats(fixture.AwayTeam, result, "away")

Actions

} } templ reviewTeamStats(team *db.Team, result *db.FixtureResult, side string) { {{ // Collect unique players for this team across all periods // We'll show the period 3 (final/cumulative) stats type playerStat struct { Username string PlayerID *int Stats *db.FixtureResultPlayerStats } finalStats := []*playerStat{} seen := map[string]bool{} // Find period 3 stats for this team (cumulative) for _, ps := range result.PlayerStats { if ps.Team == side && ps.PeriodNum == 3 { if !seen[ps.PlayerGameUserID] { seen[ps.PlayerGameUserID] = true finalStats = append(finalStats, &playerStat{ Username: ps.PlayerUsername, PlayerID: ps.PlayerID, Stats: ps, }) } } } }}

if side == "home" { Home — } else { Away — } { team.Name }

for _, ps := range finalStats { } if len(finalStats) == 0 { }
Player PP G A SV SH BL PA SC
{ ps.Username } if ps.PlayerID == nil { ? } if ps.Stats.IsFreeAgent { FREE AGENT } { intPtrStr(ps.Stats.PeriodsPlayed) } { intPtrStr(ps.Stats.Goals) } { intPtrStr(ps.Stats.Assists) } { intPtrStr(ps.Stats.Saves) } { intPtrStr(ps.Stats.Shots) } { intPtrStr(ps.Stats.Blocks) } { intPtrStr(ps.Stats.Passes) } { intPtrStr(ps.Stats.Score) }
No player stats recorded
} func intPtrStr(v *int) string { if v == nil { return "-" } return fmt.Sprint(*v) } func ordinal(n int) string { suffix := "th" if n%100 >= 11 && n%100 <= 13 { // 11th, 12th, 13th } else { switch n % 10 { case 1: suffix = "st" case 2: suffix = "nd" case 3: suffix = "rd" } } return fmt.Sprintf("%d%s", n, suffix) }