Code formatting

This commit is contained in:
2026-02-04 14:55:22 +01:00
parent 23a9011b11
commit f0ea1fb957

View File

@@ -8,16 +8,20 @@ public static class ResultsEndpoints
{ {
public static void MapResultsEndpoints(this IEndpointRouteBuilder app) public static void MapResultsEndpoints(this IEndpointRouteBuilder app)
{ {
app.MapGet("/api/results", async (HttpContext ctx, AppDbContext db) => app.MapGet(
"/api/results",
async (HttpContext ctx, AppDbContext db) =>
{ {
var phase = await EndpointHelpers.GetPhase(db); var phase = await EndpointHelpers.GetPhase(db);
if (phase != Phase.Results) if (phase != Phase.Results)
return EndpointHelpers.PhaseMismatch(Phase.Results, phase); return EndpointHelpers.PhaseMismatch(Phase.Results, phase);
var player = await EndpointHelpers.GetAuthenticatedPlayer(ctx, db); var player = await EndpointHelpers.GetAuthenticatedPlayer(ctx, db);
if (player is null) return Results.Unauthorized(); if (player is null)
return Results.Unauthorized();
var results = await db.Suggestions.AsNoTracking() var results = await db
.Suggestions.AsNoTracking()
.Include(s => s.Player) .Include(s => s.Player)
.Include(s => s.Votes) .Include(s => s.Votes)
.Select(s => new .Select(s => new
@@ -34,12 +38,13 @@ public static class ResultsEndpoints
s.YoutubeUrl, s.YoutubeUrl,
s.GameUrl, s.GameUrl,
s.Description, s.Description,
s.Genre s.Genre,
}) })
.OrderByDescending(r => r.Total) .OrderByDescending(r => r.Average)
.ToListAsync(); .ToListAsync();
return Results.Ok(results); return Results.Ok(results);
}); }
);
} }
} }