From ce06c333e1498b13ff94b9f1998f4a48fb0a108b Mon Sep 17 00:00:00 2001 From: NoLifeKing Date: Sat, 6 Jan 2024 10:13:18 +0100 Subject: [PATCH] feat: Change api format for stats --- CFLookup/Program.cs | 4 ++-- CFLookup/SharedMethods.cs | 2 +- CFLookup/StatsController.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CFLookup/Program.cs b/CFLookup/Program.cs index 6a50b43..b38143b 100644 --- a/CFLookup/Program.cs +++ b/CFLookup/Program.cs @@ -137,7 +137,7 @@ private static async Task Main(string[] args) ctx.Context.Response.Headers.Append("Cache-Control", $"public, max-age={60 * 60 * 24 * 30}"); } }); - +#if !DEBUG app.UseHangfireDashboard("/hangfire", new DashboardOptions { Authorization = new[] @@ -158,7 +158,7 @@ private static async Task Main(string[] args) }) } }); - +#endif app.UseRouting(); app.UseAuthorization(); diff --git a/CFLookup/SharedMethods.cs b/CFLookup/SharedMethods.cs index 4afda93..99e7f5e 100644 --- a/CFLookup/SharedMethods.cs +++ b/CFLookup/SharedMethods.cs @@ -356,7 +356,7 @@ public static async Task> GetMinecraftModpack public static async Task>>> GetMinecraftStatsOverTime(MSSQLDB _db, int datapoints = 1000) { - var stats = await _db.ExecuteDataTableAsync($"SELECT TOP {datapoints} * FROM MinecraftModStatsOverTime ORDER BY statId DESC"); + var stats = await _db.ExecuteDataTableAsync($"SELECT TOP {datapoints} * FROM MinecraftModStatsOverTime ORDER BY statId ASC"); var Stats = new Dictionary>>(); foreach (DataRow row in stats.Rows) { diff --git a/CFLookup/StatsController.cs b/CFLookup/StatsController.cs index 065d256..da8fa10 100644 --- a/CFLookup/StatsController.cs +++ b/CFLookup/StatsController.cs @@ -58,7 +58,7 @@ public async Task MinecraftModStatsOverTime() { var stats = await SharedMethods.GetMinecraftStatsOverTime(_db); - return new JsonResult(stats); + return new JsonResult(stats.ToArray()); } private static DateTimeOffset GetTruncatedTime(TimeSpan timeSpan)