Fixed server ranking if you have 0 xp

This commit is contained in:
Master Kwoth 2017-09-26 12:51:02 +02:00
parent 3f76106ec1
commit 747b68114a

View File

@ -40,7 +40,13 @@ namespace NadekoBot.Services.Database.Repositories.Impl
public int GetUserGuildRanking(ulong userId, ulong guildId) public int GetUserGuildRanking(ulong userId, ulong guildId)
{ {
if (!_set.Where(x => x.GuildId == guildId && x.UserId == userId).Any()) if (!_set.Where(x => x.GuildId == guildId && x.UserId == userId).Any())
return _set.Count(); {
var cnt = _set.Count(x => x.GuildId == guildId);
if (cnt == 0)
return 1;
else
return cnt;
}
return _set return _set
.Where(x => x.GuildId == guildId) .Where(x => x.GuildId == guildId)