Explorar o código

Small optimization to child count field

cvium %!s(int64=3) %!d(string=hai) anos
pai
achega
e3f0a53f59
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  1. 6 0
      Emby.Server.Implementations/Dto/DtoService.cs

+ 6 - 0
Emby.Server.Implementations/Dto/DtoService.cs

@@ -370,6 +370,12 @@ namespace Emby.Server.Implementations.Dto
                     if (item is MusicAlbum || item is Season || item is Playlist)
                     {
                         dto.ChildCount = dto.RecursiveItemCount;
+                        var folderChildCount = folder.LinkedChildren.Length;
+                        // The default is an empty array, so we can't reliably use the count when it's empty
+                        if (folderChildCount > 0)
+                        {
+                            dto.ChildCount ??= folderChildCount;
+                        }
                     }
 
                     if (options.ContainsField(ItemFields.ChildCount))