Fix played/unplayed filter for empty Series and BoxSets
This commit is contained in:
@@ -461,11 +461,12 @@ namespace MediaBrowser.Controller.Entities
|
||||
var counts = libraryManager.GetPlayedAndTotalCountBatch(folderIds, user);
|
||||
var isPlayedValue = query.IsPlayed.Value;
|
||||
|
||||
return itemList.Where(i =>
|
||||
return itemList.Where(item =>
|
||||
{
|
||||
if (i.IsFolder && counts.TryGetValue(i.Id, out var c))
|
||||
if (item is Folder)
|
||||
{
|
||||
return (c.Total > 0 && c.Played == c.Total) == isPlayedValue;
|
||||
var itemCount = counts.GetValueOrDefault(item.Id);
|
||||
return (itemCount.Played >= itemCount.Total) == isPlayedValue;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -79,14 +79,14 @@ public interface IItemQueryHelpers
|
||||
Guid ancestorId);
|
||||
|
||||
/// <summary>
|
||||
/// Builds an <see cref="IQueryable{Guid}"/> of folder IDs whose descendants are all played
|
||||
/// for the given user. Composable into outer queries to avoid an extra DB roundtrip.
|
||||
/// Builds an <see cref="IQueryable{Guid}"/> of folder IDs that have at least one unplayed
|
||||
/// descendant for the given user. Composable into outer queries to avoid an extra DB roundtrip.
|
||||
/// </summary>
|
||||
/// <param name="context">The database context the resulting query is bound to.</param>
|
||||
/// <param name="folderIds">A query yielding candidate folder IDs.</param>
|
||||
/// <param name="user">The user for access filtering and played status.</param>
|
||||
/// <returns>An <see cref="IQueryable{Guid}"/> of fully-played folder IDs.</returns>
|
||||
IQueryable<Guid> GetFullyPlayedFolderIdsQuery(
|
||||
/// <returns>An <see cref="IQueryable{Guid}"/> of folder IDs with unplayed descendants.</returns>
|
||||
IQueryable<Guid> GetFoldersWithUnplayedItemsQuery(
|
||||
JellyfinDbContext context,
|
||||
IQueryable<Guid> folderIds,
|
||||
User user);
|
||||
|
||||
Reference in New Issue
Block a user