From 31ad1ccfcdfc8ba67b4b2d8de8aa3496c04ee2d0 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sat, 22 Jan 2022 20:35:23 -0500 Subject: [PATCH] Send missing total parameter on some slot categories --- .../Controllers/SlotsController.cs | 54 +++++++++++++++++-- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/ProjectLighthouse/Controllers/SlotsController.cs b/ProjectLighthouse/Controllers/SlotsController.cs index 05fd437e..b5b69ae8 100644 --- a/ProjectLighthouse/Controllers/SlotsController.cs +++ b/ProjectLighthouse/Controllers/SlotsController.cs @@ -244,7 +244,23 @@ public class SlotsController : ControllerBase 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))); + return this.Ok + ( + LbpSerializer.TaggedStringElement + ( + "slots", + response, + new Dictionary + { + { + "hint_start", pageStart + Math.Min(pageSize, ServerSettings.Instance.EntitledSlots) + }, + { + "total", await StatisticsHelper.SlotCount() + }, + } + ) + ); } [HttpGet("slots/mostUniquePlays")] @@ -286,7 +302,23 @@ public class SlotsController : ControllerBase 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))); + return this.Ok + ( + LbpSerializer.TaggedStringElement + ( + "slots", + response, + new Dictionary + { + { + "hint_start", pageStart + Math.Min(pageSize, ServerSettings.Instance.EntitledSlots) + }, + { + "total", await StatisticsHelper.SlotCount() + }, + } + ) + ); } [HttpGet("slots/mostHearted")] @@ -314,7 +346,23 @@ public class SlotsController : ControllerBase 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))); + return this.Ok + ( + LbpSerializer.TaggedStringElement + ( + "slots", + response, + new Dictionary + { + { + "hint_start", pageStart + Math.Min(pageSize, ServerSettings.Instance.EntitledSlots) + }, + { + "total", await StatisticsHelper.SlotCount() + }, + } + ) + ); } public GameVersion GetGameFilter(string? gameFilterType, GameVersion version)