From 4b2db485501683dfc29fdc83e923ed01931d744c Mon Sep 17 00:00:00 2001 From: jvyden Date: Tue, 9 Nov 2021 21:25:39 -0500 Subject: [PATCH] Make lucky dip actually random --- ProjectLighthouse/Controllers/SlotsController.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ProjectLighthouse/Controllers/SlotsController.cs b/ProjectLighthouse/Controllers/SlotsController.cs index 727a56dd..b8591722 100644 --- a/ProjectLighthouse/Controllers/SlotsController.cs +++ b/ProjectLighthouse/Controllers/SlotsController.cs @@ -117,13 +117,14 @@ namespace LBPUnion.ProjectLighthouse.Controllers GameVersion gameVersion = token.GameVersion; // TODO: Incorporate seed? - IQueryable slots = this.database.Slots.Where(s => s.GameVersion <= gameVersion) - .OrderBy(_ => Guid.NewGuid()) + IOrderedEnumerable slots = this.database.Slots.Where(s => s.GameVersion <= gameVersion) .Include(s => s.Creator) .Include(s => s.Location) .Skip(pageStart - 1) - .Take(Math.Min(pageSize, 30)); - string response = Enumerable.Aggregate(slots, string.Empty, (current, slot) => current + slot.Serialize()); + .Take(Math.Min(pageSize, 30)) + .AsEnumerable() + .OrderBy(_ => Guid.NewGuid()); + string response = slots.Aggregate(string.Empty, (current, slot) => current + slot.Serialize()); return this.Ok(LbpSerializer.TaggedStringElement("slots", response, "hint_start", pageStart + Math.Min(pageSize, 30))); }