Include player counts in results payload

This commit is contained in:
2026-02-03 02:06:51 +01:00
parent 8af26f89b3
commit 711c78d762
2 changed files with 3 additions and 1 deletions

View File

@@ -25,6 +25,8 @@ public static class ResultsEndpoints
s.Id, s.Id,
s.Name, s.Name,
Author = s.Player!.DisplayName, Author = s.Player!.DisplayName,
s.MinPlayers,
s.MaxPlayers,
Total = s.Votes.Sum(v => v.Score), Total = s.Votes.Sum(v => v.Score),
Count = s.Votes.Count, Count = s.Votes.Count,
Average = s.Votes.Count == 0 ? 0 : s.Votes.Average(v => v.Score), Average = s.Votes.Count == 0 ? 0 : s.Votes.Average(v => v.Score),

View File

@@ -263,7 +263,7 @@ function buildResultMeta(r) {
const hasPlayers = r.minPlayers || r.maxPlayers; const hasPlayers = r.minPlayers || r.maxPlayers;
const players = hasPlayers const players = hasPlayers
? t("card.players", { min: r.minPlayers ?? "?", max: r.maxPlayers ?? "?" }) ? t("card.players", { min: r.minPlayers ?? "?", max: r.maxPlayers ?? "?" })
: null; : "wtf";
const bits = [r.genre, players].filter(Boolean); const bits = [r.genre, players].filter(Boolean);
if (bits.length === 0) return ""; if (bits.length === 0) return "";
return `<div class="muted small">${bits.join(" • ")}</div>`; return `<div class="muted small">${bits.join(" • ")}</div>`;