Browse Source

Fix BoxSet sorting (#14919)

Co-authored-by: Cody Robibero <cody@robibe.ro>
theguymadmax 1 week ago
parent
commit
0f42aa892e
1 changed files with 8 additions and 0 deletions
  1. 8 0
      MediaBrowser.Controller/Entities/Folder.cs

+ 8 - 0
MediaBrowser.Controller/Entities/Folder.cs

@@ -1351,6 +1351,14 @@ namespace MediaBrowser.Controller.Entities
             var realChildren = visibleChildren
             var realChildren = visibleChildren
                 .Where(e => query is null || UserViewBuilder.FilterItem(e, query))
                 .Where(e => query is null || UserViewBuilder.FilterItem(e, query))
                 .ToArray();
                 .ToArray();
+
+            if (this is BoxSet && (query.OrderBy is null || query.OrderBy.Count == 0))
+            {
+                realChildren = realChildren
+                    .OrderBy(e => e.ProductionYear ?? int.MaxValue)
+                    .ToArray();
+            }
+
             var childCount = realChildren.Length;
             var childCount = realChildren.Length;
             if (result.Count < limit)
             if (result.Count < limit)
             {
             {