Add voter tooltips across results emojis and average

This commit is contained in:
2026-02-17 19:06:05 +01:00
parent 4d62d0bf50
commit 26379eef1a
10 changed files with 107 additions and 11 deletions

View File

@@ -32,6 +32,9 @@ internal sealed class ResultsWorkflowService(AppDbContext db)
s.Votes.Count,
Average = s.Votes.Count == 0 ? 0 : s.Votes.Average(v => v.Score),
Votes = s.Votes.Select(v => v.Score).ToList(),
VoterNames = s.Votes
.Select(v => v.Player!.DisplayName ?? v.Player!.Username)
.ToList(),
MyVote = s.Votes
.Where(v => v.PlayerId == playerId)
.Select(v => (int?)v.Score)
@@ -59,6 +62,11 @@ internal sealed class ResultsWorkflowService(AppDbContext db)
.Where(nameLookup.ContainsKey)
.Select(id => nameLookup[id])
.ToList();
var voterNames = r.VoterNames
.Where(name => !string.IsNullOrWhiteSpace(name))
.Distinct(StringComparer.OrdinalIgnoreCase)
.OrderBy(name => name, StringComparer.OrdinalIgnoreCase)
.ToList();
return new ResultItemDto(
r.Id,
@@ -70,6 +78,7 @@ internal sealed class ResultsWorkflowService(AppDbContext db)
r.Count,
r.Average,
r.Votes,
voterNames,
r.MyVote,
r.ScreenshotUrl,
r.YoutubeUrl,