package seasonsview import "git.haelnorr.com/h/oslstats/internal/db" import "git.haelnorr.com/h/oslstats/internal/view/baseview" import "git.haelnorr.com/h/oslstats/internal/view/component/links" 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

@links.TeamNameLinkInSeason(fixture.HomeTeam, fixture.Season, fixture.League) vs @links.TeamNameLinkInSeason(fixture.AwayTeam, fixture.Season, fixture.League) 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

@links.TeamNameLinkInSeason(fixture.HomeTeam, fixture.Season, fixture.League)

{ fmt.Sprint(result.HomeScore) }

@links.TeamNameLinkInSeason(fixture.AwayTeam, fixture.Season, fixture.League)

{ 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", fixture.Season, fixture.League) @reviewTeamStats(fixture.AwayTeam, result, "away", fixture.Season, fixture.League)

Actions

} } templ reviewTeamStats(team *db.Team, result *db.FixtureResult, side string, season *db.Season, league *db.League) { {{ // 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 — } @links.TeamNameLinkInSeason(team, season, league)

for _, ps := range finalStats { } if len(finalStats) == 0 { }
Player PP G A SV SH BL PA SC
if ps.PlayerID != nil { @links.PlayerLinkFromStats(*ps.PlayerID, ps.Username) } else { { ps.Username } ? } 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) }