Merge branch 'main' into server-split

This commit is contained in:
jvyden 2022-05-14 17:04:30 -04:00
commit bb03a01246
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278

View file

@ -56,7 +56,11 @@ public class SlotsPage : BaseLayout
this.SearchValue = name.Trim();
this.SlotCount = await this.Database.Slots.CountAsync(p => p.Name.Contains(this.SearchValue));
this.SlotCount = await this.Database.Slots.Include(p => p.Creator)
.Where(p => p.Name.Contains(finalSearch.ToString()))
.Where(p => p.Creator != null && (targetAuthor == null || string.Equals(p.Creator.Username.ToLower(), targetAuthor.ToLower())))
.Where(p => targetGame == null || p.GameVersion == targetGame)
.CountAsync();
this.PageNumber = pageNumber;
this.PageAmount = Math.Max(1, (int)Math.Ceiling((double)this.SlotCount / ServerStatics.PageSize));
@ -72,8 +76,6 @@ public class SlotsPage : BaseLayout
.Take(ServerStatics.PageSize)
.ToListAsync();
this.SlotCount = this.Slots.Count;
return this.Page();
}
}