Remove ordering items

This commit is contained in:
Bond-009
2019-02-26 20:47:23 +01:00
parent 9bab93262e
commit 1731bf7372
8 changed files with 27 additions and 83 deletions

View File

@@ -36,9 +36,7 @@ namespace MediaBrowser.Controller.Dto
.ToArray();
public bool ContainsField(ItemFields field)
{
return AllItemFields.Contains(field);
}
=> Fields.Contains(field);
public DtoOptions(bool allFields)
{
@@ -47,15 +45,7 @@ namespace MediaBrowser.Controller.Dto
EnableUserData = true;
AddCurrentProgram = true;
if (allFields)
{
Fields = AllItemFields;
}
else
{
Fields = new ItemFields[] { };
}
Fields = allFields ? AllItemFields : Array.Empty<ItemFields>();
ImageTypes = AllImageTypes;
}

View File

@@ -57,9 +57,7 @@ namespace MediaBrowser.Controller.Dto
/// <param name="options">The options.</param>
/// <param name="user">The user.</param>
/// <param name="owner">The owner.</param>
BaseItemDto[] GetBaseItemDtos(BaseItem[] items, DtoOptions options, User user = null, BaseItem owner = null);
BaseItemDto[] GetBaseItemDtos(List<BaseItem> items, DtoOptions options, User user = null, BaseItem owner = null);
BaseItemDto[] GetBaseItemDtos(IReadOnlyList<BaseItem> items, DtoOptions options, User user = null, BaseItem owner = null);
/// <summary>
/// Gets the item by name dto.

View File

@@ -810,37 +810,19 @@ namespace MediaBrowser.Controller.Entities
{
if (query.ItemIds.Length > 0)
{
var result = LibraryManager.GetItemsResult(query);
if (query.OrderBy.Length == 0)
{
var ids = query.ItemIds.ToList();
// Try to preserve order
result.Items = result.Items.OrderBy(i => ids.IndexOf(i.Id)).ToArray();
}
return result;
return LibraryManager.GetItemsResult(query);
}
return GetItemsInternal(query);
}
public BaseItem[] GetItemList(InternalItemsQuery query)
public IReadOnlyList<BaseItem> GetItemList(InternalItemsQuery query)
{
query.EnableTotalRecordCount = false;
if (query.ItemIds.Length > 0)
{
var result = LibraryManager.GetItemList(query);
if (query.OrderBy.Length == 0)
{
var ids = query.ItemIds.ToList();
// Try to preserve order
return result.OrderBy(i => ids.IndexOf(i.Id)).ToArray();
}
return result.ToArray();
return LibraryManager.GetItemList(query);
}
return GetItemsInternal(query).Items;