From ecdf5fa1f667f27c18ab701530ef851691a5bcc0 Mon Sep 17 00:00:00 2001 From: Josh Date: Sat, 14 May 2022 15:21:52 -0500 Subject: [PATCH] Fix total level count (#308) --- ProjectLighthouse/Pages/SlotsPage.cshtml.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ProjectLighthouse/Pages/SlotsPage.cshtml.cs b/ProjectLighthouse/Pages/SlotsPage.cshtml.cs index 2a87d653..5de0a35a 100644 --- a/ProjectLighthouse/Pages/SlotsPage.cshtml.cs +++ b/ProjectLighthouse/Pages/SlotsPage.cshtml.cs @@ -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(); } } \ No newline at end of file