mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-19 21:44:30 -04:00
Fixed: Error fetching paged records from API without a sort key
(cherry picked from commit 53f1857e6349fc4c674dbaec50b0dda681f073ae)
This commit is contained in:
@@ -407,6 +407,11 @@ namespace NzbDrone.Core.Datastore
|
||||
{
|
||||
AddFilters(builder, pagingSpec);
|
||||
|
||||
if (pagingSpec.SortKey == null)
|
||||
{
|
||||
pagingSpec.SortKey = $"{_table}.{_keyProperty.Name}";
|
||||
}
|
||||
|
||||
var sortDirection = pagingSpec.SortDirection == SortDirection.Descending ? "DESC" : "ASC";
|
||||
var pagingOffset = (pagingSpec.Page - 1) * pagingSpec.PageSize;
|
||||
builder.OrderBy($"{pagingSpec.SortKey} {sortDirection} LIMIT {pagingSpec.PageSize} OFFSET {pagingOffset}");
|
||||
|
||||
Reference in New Issue
Block a user