-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix only returning one item from /Item/Latest api. #12492
base: master
Are you sure you want to change the base?
Conversation
(cherry picked from commit da313e5)
| @@ -2592,6 +2592,106 @@ public List<BaseItem> GetItemList(InternalItemsQuery query) | |||
| return items; | |||
| } | |||
|
|
|||
| public List<BaseItem> GetLatestItemList(InternalItemsQuery query, CollectionType collectionType) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| public List<BaseItem> GetLatestItemList(InternalItemsQuery query, CollectionType collectionType) | |
| public IReadOnlyList<BaseItem> GetLatestItemList(InternalItemsQuery query, CollectionType collectionType) |
| // Early exit if the distinct column is null | ||
| if (string.IsNullOrEmpty(distintColumn)) | ||
| { | ||
| return Enumerable.Empty<BaseItem>().ToList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return Enumerable.Empty<BaseItem>().ToList(); | |
| return Array.Empty<BaseItem>(); |
The whole point of using the static method is to share the instance, a ToList does negate that advantage
| @@ -1339,6 +1339,21 @@ public List<BaseItem> GetItemList(InternalItemsQuery query, List<BaseItem> paren | |||
| return _itemRepository.GetItemList(query); | |||
| } | |||
|
|
|||
| public List<BaseItem> GetItemList(InternalItemsQuery query, List<BaseItem> parents, CollectionType collectionType) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| public List<BaseItem> GetItemList(InternalItemsQuery query, List<BaseItem> parents, CollectionType collectionType) | |
| public IReadOnlyList<BaseItem> GetItemList(InternalItemsQuery query, IEnumerable<BaseItem> parents, CollectionType collectionType) |
| /// <param name="parents">Items to use for query.</param> | ||
| /// <param name="collectionType">Collection Type.</param> | ||
| /// <returns>List of items.</returns> | ||
| List<BaseItem> GetItemList(InternalItemsQuery query, List<BaseItem> parents, CollectionType collectionType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| List<BaseItem> GetItemList(InternalItemsQuery query, List<BaseItem> parents, CollectionType collectionType); | |
| IReadOnlyList<BaseItem> GetItemList(InternalItemsQuery query, IEnumerable<BaseItem> parents, CollectionType collectionType); |
| /// <param name="query">The query.</param> | ||
| /// <param name="collectionType">Collection Type.</param> | ||
| /// <returns>List<BaseItem>.</returns> | ||
| List<BaseItem> GetLatestItemList(InternalItemsQuery query, CollectionType collectionType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| List<BaseItem> GetLatestItemList(InternalItemsQuery query, CollectionType collectionType); | |
| IReadOnlyList<BaseItem> GetLatestItemList(InternalItemsQuery query, CollectionType collectionType); |
| } | ||
| } | ||
|
|
||
| return items; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return items; | |
| return items.ToReadOnlyArray(); |
|
@Bond-009 it would be good to know if this is on your radar? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blocked by EFCore rewrite
Changes
Adds an extra function to the SqliteItemRepository to do a sub query to get the top N number of unique series/albums names sorted by datecreated. The min value of the datecreated from the subquery is then used to retrieve the rows for use for the /item/latest api.
Issues
Fixes #10993
Fixes #1880