Replace demo stats with real data

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Ivan Cacciari
2026-09-01 22:34:07 +02:00
co-authored by Cursor
parent c314a08f6d
commit d63beae04c
6 changed files with 70 additions and 47 deletions
+14
View File
@@ -84,3 +84,17 @@ export function vincitoriMvp(voti: VotoMvp[]): Record<string, string> {
export function mioVoto(voti: VotoMvp[], matchId: string, votanteId: string) {
return voti.find((v) => v.match_id === matchId && v.votante_id === votanteId) ?? null;
}
/** MVP vinti per giocatore, contando una vittoria per partita votata. */
export function mvpVintiPerGiocatore(voti: VotoMvp[]): Record<string, number> {
const out: Record<string, number> = {};
const matchIds = new Set(voti.map((v) => v.match_id));
for (const matchId of matchIds) {
const top = conteggioPartita(voti, matchId);
if (top.length > 0 && (top.length === 1 || top[0]!.voti > top[1]!.voti)) {
const id = top[0]!.id;
out[id] = (out[id] ?? 0) + 1;
}
}
return out;
}