Skip to content

Commit

Permalink
feat: Change api format for stats
Browse files Browse the repository at this point in the history
  • Loading branch information
itssimple committed Jan 6, 2024
1 parent 884ab98 commit ce06c33
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CFLookup/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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[]
Expand All @@ -158,7 +158,7 @@ private static async Task Main(string[] args)
})
}
});

#endif
app.UseRouting();

app.UseAuthorization();
Expand Down
2 changes: 1 addition & 1 deletion CFLookup/SharedMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ public static async Task<ConcurrentDictionary<string, long>> GetMinecraftModpack

public static async Task<Dictionary<DateTimeOffset, Dictionary<string, Dictionary<string, long>>>> 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<DateTimeOffset, Dictionary<string, Dictionary<string, long>>>();
foreach (DataRow row in stats.Rows)
{
Expand Down
2 changes: 1 addition & 1 deletion CFLookup/StatsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public async Task<IActionResult> MinecraftModStatsOverTime()
{
var stats = await SharedMethods.GetMinecraftStatsOverTime(_db);

return new JsonResult(stats);
return new JsonResult(stats.ToArray());
}

private static DateTimeOffset GetTruncatedTime(TimeSpan timeSpan)
Expand Down

0 comments on commit ce06c33

Please sign in to comment.