diff --git a/ReplayBrowser/Helpers/ReplayHelper.cs b/ReplayBrowser/Helpers/ReplayHelper.cs index f3f074e..50de180 100644 --- a/ReplayBrowser/Helpers/ReplayHelper.cs +++ b/ReplayBrowser/Helpers/ReplayHelper.cs @@ -342,7 +342,7 @@ public static void CheckAccountAccess(Account? caller, Account? found) var account = await _context.Accounts .Include(a => a.Settings) - .FirstOrDefaultAsync(a => a.Username == username); + .FirstOrDefaultAsync(a => a.Guid == player.PlayerGuid); if (account != null && account.Settings.RedactInformation && account.Guid != accountGuid) { @@ -405,6 +405,7 @@ public static void CheckAccountAccess(Account? caller, Account? found) }; } + // Get total result count, cache it // Technically it might be inaccurate. In practice nobody will care much? int totalItems = _cache.GetOrCreate(cacheKey, e => { @@ -413,7 +414,6 @@ public static void CheckAccountAccess(Account? caller, Account? found) return queryable.Count(); }); - // Get all results and store them in the cache var allResults = queryable .OrderByDescending(r => r.Date ?? DateTime.MinValue) .Skip(page * pageSize)