From 2217c2080396e6e18dda9b4656694d47c9ead91b Mon Sep 17 00:00:00 2001 From: Slendy Date: Sat, 24 Sep 2022 21:34:05 -0500 Subject: [PATCH] Fix favouritePlaylists logic --- .../Controllers/Slots/ListController.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/ListController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/ListController.cs index b3936942..f9783862 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/ListController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/ListController.cs @@ -210,10 +210,8 @@ public class ListController : ControllerBase int targetUserId = await this.database.Users.Where(u => u.Username == username).Select(u => u.UserId).FirstOrDefaultAsync(); if (targetUserId == 0) return this.StatusCode(403, ""); - IEnumerable heartedPlaylists = this.database.Playlists.Include(p => p.Creator).Where(p => p.CreatorId == targetUserId) - .Skip(Math.Max(0, pageStart - 1)) - .Take(Math.Min(pageSize, 30)) - .AsEnumerable(); + IEnumerable heartedPlaylists = this.database.HeartedPlaylists.Where(p => p.UserId == targetUserId) + .Include(p => p.Playlist).Include(p => p.Playlist.Creator).OrderByDescending(p => p.HeartedPlaylistId).Select(p => p.Playlist); string response = heartedPlaylists.Aggregate(string.Empty, (current, p) => current + p.Serialize());