Fix regression from #132

Closes #134
This commit is contained in:
jvyden 2022-02-02 13:31:44 -05:00
parent 5df6fbbb1c
commit b31522733c
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
3 changed files with 5 additions and 8 deletions

View file

@ -39,8 +39,7 @@ public class PhotosPage : BaseLayout
if (this.PageNumber < 0 || this.PageNumber >= this.PageAmount) return this.Redirect($"/photos/{Math.Clamp(this.PageNumber, 0, this.PageAmount - 1)}");
this.Photos = await this.Database.Photos.Include
(p => p.Creator)
this.Photos = await this.Database.Photos.Include(p => p.Creator)
.Where(p => p.Creator.Username.Contains(name) || p.PhotoSubjectCollection.Contains(name))
.OrderByDescending(p => p.Timestamp)
.Skip(pageNumber * ServerStatics.PageSize)

View file

@ -4,7 +4,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using JetBrains.Annotations;
using LBPUnion.ProjectLighthouse.Helpers;
using LBPUnion.ProjectLighthouse.Pages.Layouts;
using LBPUnion.ProjectLighthouse.Types.Levels;
using LBPUnion.ProjectLighthouse.Types.Settings;
@ -37,12 +36,12 @@ public class SlotsPage : BaseLayout
this.SearchValue = name;
this.PageNumber = pageNumber;
this.PageAmount = Math.Max(1, (int) Math.Ceiling((double) this.SlotCount / ServerStatics.PageSize));
this.PageAmount = Math.Max(1, (int)Math.Ceiling((double)this.SlotCount / ServerStatics.PageSize));
if (this.PageNumber < 0 || this.PageNumber >= this.PageAmount) return this.Redirect($"/slots/{Math.Clamp(this.PageNumber, 0, this.PageAmount - 1)}");
this.Slots = await this.Database.Slots.Where
(p => p.Name.Contains(name))
this.Slots = await this.Database.Slots.Include(p => p.Creator)
.Where(p => p.Name.Contains(name))
.OrderByDescending(p => p.FirstUploaded)
.Skip(pageNumber * ServerStatics.PageSize)
.Take(ServerStatics.PageSize)

View file

@ -39,8 +39,7 @@ public class UsersPage : BaseLayout
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.Where
(u => !u.Banned && u.Username.Contains(name))
this.Users = await this.Database.Users.Where(u => !u.Banned && u.Username.Contains(name))
.OrderByDescending(b => b.UserId)
.Skip(pageNumber * ServerStatics.PageSize)
.Take(ServerStatics.PageSize)