Remove unnecessary materializations

This commit is contained in:
Shadowghost
2026-04-26 17:55:19 +02:00
parent f806ae4018
commit fc866a64e0
6 changed files with 13 additions and 35 deletions

View File

@@ -150,13 +150,9 @@ public class NextUpService : INextUpService
.Where(id => id != Guid.Empty)
.Distinct()
.ToList();
var lastWatchedEpisodes = new Dictionary<Guid, BaseItemEntity>();
if (allLastWatchedIds.Count > 0)
{
var lwQuery = context.BaseItems.AsNoTracking().Where(e => allLastWatchedIds.Contains(e.Id));
lwQuery = _queryHelpers.ApplyNavigations(lwQuery, filter);
lastWatchedEpisodes = lwQuery.ToDictionary(e => e.Id);
}
var lwQuery = context.BaseItems.AsNoTracking().Where(e => allLastWatchedIds.Contains(e.Id));
lwQuery = _queryHelpers.ApplyNavigations(lwQuery, filter);
var lastWatchedEpisodes = lwQuery.ToDictionary(e => e.Id);
Dictionary<string, List<BaseItemEntity>> specialsBySeriesKey = new();
if (includeSpecials)