From 4833ccd65ac268a33f7f7e1304428af48b3543dc Mon Sep 17 00:00:00 2001 From: runebaas Date: Sun, 12 May 2019 17:29:52 +0200 Subject: [PATCH] Use SortedDictionary for Highscores instead of a simple Dictionary --- Geekbot.net/Commands/User/Ranking/Rank.cs | 4 ++-- Geekbot.net/Lib/Highscores/HighscoreManager.cs | 4 ++-- Geekbot.net/Lib/Highscores/IHighscoreManager.cs | 2 +- .../WebApi/Controllers/Highscores/HighscoreController.cs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Geekbot.net/Commands/User/Ranking/Rank.cs b/Geekbot.net/Commands/User/Ranking/Rank.cs index 0ad21d5..1cd45e8 100644 --- a/Geekbot.net/Commands/User/Ranking/Rank.cs +++ b/Geekbot.net/Commands/User/Ranking/Rank.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -63,7 +63,7 @@ namespace Geekbot.net.Commands.User.Ranking } var guildId = Context.Guild.Id; - Dictionary highscoreUsers; + SortedDictionary highscoreUsers; try { highscoreUsers = _highscoreManager.GetHighscoresWithUserData(type, guildId, amount); diff --git a/Geekbot.net/Lib/Highscores/HighscoreManager.cs b/Geekbot.net/Lib/Highscores/HighscoreManager.cs index f3b3a18..02a0b69 100644 --- a/Geekbot.net/Lib/Highscores/HighscoreManager.cs +++ b/Geekbot.net/Lib/Highscores/HighscoreManager.cs @@ -20,7 +20,7 @@ namespace Geekbot.net.Lib.Highscores } - public Dictionary GetHighscoresWithUserData(HighscoreTypes type, ulong guildId, int amount) + public SortedDictionary GetHighscoresWithUserData(HighscoreTypes type, ulong guildId, int amount) { Dictionary list; switch (type) @@ -47,7 +47,7 @@ namespace Geekbot.net.Lib.Highscores throw new HighscoreListEmptyException($"No {type} found for guild {guildId}"); } - var highscoreUsers = new Dictionary(); + var highscoreUsers = new SortedDictionary(); foreach (var user in list) { try diff --git a/Geekbot.net/Lib/Highscores/IHighscoreManager.cs b/Geekbot.net/Lib/Highscores/IHighscoreManager.cs index a09b07e..aca3513 100644 --- a/Geekbot.net/Lib/Highscores/IHighscoreManager.cs +++ b/Geekbot.net/Lib/Highscores/IHighscoreManager.cs @@ -4,7 +4,7 @@ namespace Geekbot.net.Lib.Highscores { public interface IHighscoreManager { - Dictionary GetHighscoresWithUserData(HighscoreTypes type, ulong guildId, int amount); + SortedDictionary GetHighscoresWithUserData(HighscoreTypes type, ulong guildId, int amount); Dictionary GetMessageList(ulong guildId, int amount); Dictionary GetKarmaList(ulong guildId, int amount); Dictionary GetRollsList(ulong guildId, int amount); diff --git a/Geekbot.net/WebApi/Controllers/Highscores/HighscoreController.cs b/Geekbot.net/WebApi/Controllers/Highscores/HighscoreController.cs index 3cccb0e..2b03260 100644 --- a/Geekbot.net/WebApi/Controllers/Highscores/HighscoreController.cs +++ b/Geekbot.net/WebApi/Controllers/Highscores/HighscoreController.cs @@ -25,7 +25,7 @@ namespace Geekbot.net.WebApi.Controllers.Highscores return BadRequest(error); } - Dictionary list; + SortedDictionary list; try { list = _highscoreManager.GetHighscoresWithUserData(body.Type, body.GuildId, body.Amount);