.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)
{
return (from orduser in _set
group orduser by orduser.UserId into g
orderby g.Sum(x => x.Xp) descending
select new { UserId = g.Key, TotalXp = g.Sum(x => x.Xp) })
.Skip(page * 9)
.Take(9)
.AsEnumerable()
.Select(x => (x.UserId, x.TotalXp))
.ToArray();
return _set.GroupBy(x => x.UserId)
.OrderByDescending(x => x.Sum(y => y.Xp))
.Skip(page * 9)
.Take(9)
.AsEnumerable()
.Select(x => (x.Key, x.Sum(y => y.Xp)))
.ToArray();
}
}
}