Pular para o conteúdo principal

computeTopScorers

@raizfc/contracts


@raizfc/contracts / computeTopScorers

Function: computeTopScorers()

computeTopScorers(matches): readonly Readonly<{ assists: number; badges: readonly "provisional"[]; displayName: string; goals: number; matchesPlayed: number; playerId?: string; position: number; publicRoute?: string; status: RankingRowStatus; teamId: string; teamName: string; teamRoute: string; }>[]

Defined in: ranking/top-scorer-formula.ts:50

Aggregates goals/assists by scorer identity (playerId when known, otherwise a team-scoped guest key — a guest is never globally unique by name alone) across every match supplied, sorted by goals desc then assists desc then name asc. Only scorers with at least one goal appear — this is an artilharia (top scorers) list, not a general appearances roster.

Parameters

matches

readonly Readonly<{ appearances: readonly Readonly<{ displayName: string; playerId?: string; publicRoute?: string; teamId: string; teamName: string; teamRoute: string; }>[]; goalEvents: readonly Readonly<{ assist?: Readonly<{ displayName: string; playerId?: string; publicRoute?: string; teamId: string; teamName: string; teamRoute: string; }>; scorer: ScorerAppearanceInput; }>[]; matchId: string; }>[]

Returns

readonly Readonly<{ assists: number; badges: readonly "provisional"[]; displayName: string; goals: number; matchesPlayed: number; playerId?: string; position: number; publicRoute?: string; status: RankingRowStatus; teamId: string; teamName: string; teamRoute: string; }>[]