Add voter tooltips across results emojis and average
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user