diff options
| author | Shadowghost <Ghost_of_Stone@web.de> | 2026-08-21 22:59:14 +0200 |
|---|---|---|
| committer | Shadowghost <Ghost_of_Stone@web.de> | 2026-08-21 22:59:39 +0200 |
| commit | 335d97d8688957c7813b13e82210c291ae555683 (patch) | |
| tree | 434da1db9b53af149cac094ef47317689f8ade25 | |
| parent | 8e80677bdd6471d04748cfcca41f997f2f48b341 (diff) | |
Use WhereOneOrMany
| -rw-r--r-- | Jellyfin.Server.Implementations/Item/ItemCountService.cs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Jellyfin.Server.Implementations/Item/ItemCountService.cs b/Jellyfin.Server.Implementations/Item/ItemCountService.cs index b276a14536..c42b5f9581 100644 --- a/Jellyfin.Server.Implementations/Item/ItemCountService.cs +++ b/Jellyfin.Server.Implementations/Item/ItemCountService.cs @@ -292,11 +292,11 @@ public class ItemCountService : IItemCountService private IQueryable<BaseItemEntity> BuildGroupedDescendantsQuery(JellyfinDbContext dbContext, InternalItemsQuery filter, Guid ancestorId) { var ancestorIds = GetPresentationKeyGroups(dbContext, [ancestorId])[ancestorId]; - var descendantIds = DescendantQueryHelper.GetAllDescendantIdsBatch(dbContext, ancestorIds); + var descendantIds = DescendantQueryHelper.GetAllDescendantIdsBatch(dbContext, ancestorIds).ToArray(); var baseQuery = dbContext.BaseItems .AsNoTracking() - .Where(b => descendantIds.Contains(b.Id)) + .WhereOneOrMany(descendantIds, b => b.Id) .Where(DescendantQueryHelper.IsCountableLeaf); return _queryHelpers.ApplyAccessFiltering(dbContext, baseQuery, filter); @@ -309,9 +309,9 @@ public class ItemCountService : IItemCountService ArgumentNullException.ThrowIfNull(filter.User); using var dbContext = _dbProvider.CreateDbContext(); - var allDescendantIds = DescendantQueryHelper.GetAllDescendantIds(dbContext, parentId); + var allDescendantIds = DescendantQueryHelper.GetAllDescendantIdsBatch(dbContext, [parentId]).ToArray(); var baseQuery = dbContext.BaseItems - .Where(b => allDescendantIds.Contains(b.Id)) + .WhereOneOrMany(allDescendantIds, b => b.Id) .Where(DescendantQueryHelper.IsCountableLeaf); baseQuery = _queryHelpers.ApplyAccessFiltering(dbContext, baseQuery, filter); |
