Dont show banned users on UsersPage

This commit is contained in:
jvyden 2022-01-19 08:56:59 -05:00
parent 1ba31fb8ed
commit 57ba3f76ff
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
2 changed files with 4 additions and 3 deletions

View file

@ -12,7 +12,7 @@ public static class StatisticsHelper
public static async Task<int> SlotCount() => await database.Slots.CountAsync(); public static async Task<int> SlotCount() => await database.Slots.CountAsync();
public static async Task<int> UserCount() => await database.Users.CountAsync(); public static async Task<int> UserCount() => await database.Users.CountAsync(u => !u.Banned);
public static async Task<int> MMPicksCount() => await database.Slots.CountAsync(s => s.TeamPick); public static async Task<int> MMPicksCount() => await database.Slots.CountAsync(s => s.TeamPick);

View file

@ -34,8 +34,9 @@ public class UsersPage : BaseLayout
if (this.PageNumber < 0 || this.PageNumber >= this.PageAmount) return this.Redirect($"/users/{Math.Clamp(this.PageNumber, 0, this.PageAmount - 1)}"); if (this.PageNumber < 0 || this.PageNumber >= this.PageAmount) return this.Redirect($"/users/{Math.Clamp(this.PageNumber, 0, this.PageAmount - 1)}");
this.Users = await this.Database.Users.OrderByDescending this.Users = await this.Database.Users.Where
(p => p.UserId) (u => !u.Banned)
.OrderByDescending(b => b.UserId)
.Skip(pageNumber * ServerStatics.PageSize) .Skip(pageNumber * ServerStatics.PageSize)
.Take(ServerStatics.PageSize) .Take(ServerStatics.PageSize)
.ToListAsync(); .ToListAsync();