diff --git a/backend/api/Services/SortingService.cs b/backend/api/Services/SortingService.cs index 10bb9e5da..193032579 100644 --- a/backend/api/Services/SortingService.cs +++ b/backend/api/Services/SortingService.cs @@ -9,9 +9,6 @@ public class SortingService { public static void ApplySort(ref IQueryable missions, string orderByQueryString) where T : SortableRecord { - if (!missions.Any()) - return; - if (string.IsNullOrWhiteSpace(orderByQueryString)) { missions = missions.OrderBy(x => x.Name); diff --git a/backend/api/Utilities/PagedList.cs b/backend/api/Utilities/PagedList.cs index 7e84e31a9..ea78a816c 100644 --- a/backend/api/Utilities/PagedList.cs +++ b/backend/api/Utilities/PagedList.cs @@ -33,14 +33,8 @@ public static async Task> ToPagedListAsync( int pageSize ) { - // Adding order by constant value 1, which does not change order of rows - // but stops the runtime warning int totalCount = await source.CountAsync(); - List items; - if (source.Expression.Type is IOrderedQueryable) - items = await source.Skip((pageNumber - 1) * pageSize).Take(pageSize).ToListAsync(); - else - items = await source.OrderBy(x => 1).Skip((pageNumber - 1) * pageSize).Take(pageSize).ToListAsync(); + var items = await source.Skip((pageNumber - 1) * pageSize).Take(pageSize).ToListAsync(); return new PagedList(items, pageNumber, pageSize, totalCount); } }