.xpglb should be faster now.

This commit is contained in:
Master Kwoth 2017-09-12 05:00:14 +02:00
parent f08fd3bdb1
commit d51c28b73c

View File

@ -65,15 +65,13 @@ namespace NadekoBot.Services.Database.Repositories.Impl
public (ulong UserId, int TotalXp)[] GetUsersFor(int page) public (ulong UserId, int TotalXp)[] GetUsersFor(int page)
{ {
return (from orduser in _set return _set.GroupBy(x => x.UserId)
group orduser by orduser.UserId into g .OrderByDescending(x => x.Sum(y => y.Xp))
orderby g.Sum(x => x.Xp) descending .Skip(page * 9)
select new { UserId = g.Key, TotalXp = g.Sum(x => x.Xp) }) .Take(9)
.Skip(page * 9) .AsEnumerable()
.Take(9) .Select(x => (x.Key, x.Sum(y => y.Xp)))
.AsEnumerable() .ToArray();
.Select(x => (x.UserId, x.TotalXp))
.ToArray();
} }
} }
} }