diff --git a/Shoko.Server/API/v3/Controllers/GroupController.cs b/Shoko.Server/API/v3/Controllers/GroupController.cs index 8f835337b..e90076386 100644 --- a/Shoko.Server/API/v3/Controllers/GroupController.cs +++ b/Shoko.Server/API/v3/Controllers/GroupController.cs @@ -9,7 +9,6 @@ using Shoko.Server.API.v3.Helpers; using Shoko.Server.API.v3.Models.Common; using Shoko.Server.API.v3.Models.Shoko; -using Shoko.Server.Extensions; using Shoko.Server.Models; using Shoko.Server.Repositories; using Shoko.Server.Tasks; @@ -58,7 +57,7 @@ public ActionResult> GetAllGroups([FromQuery] [Range(0, 100)] return includeEmpty || group.GetAllSeries().Any(s => s.GetAnimeEpisodes().Any(e => e.GetVideoLocals().Count > 0)); }) - .OrderByName() + .OrderBy(group => group.GroupName) .ToListResult(group => new Group(HttpContext, group, randomImages), page, pageSize); } diff --git a/Shoko.Server/API/v3/Controllers/TreeController.cs b/Shoko.Server/API/v3/Controllers/TreeController.cs index b9b2a6687..3510f0be7 100644 --- a/Shoko.Server/API/v3/Controllers/TreeController.cs +++ b/Shoko.Server/API/v3/Controllers/TreeController.cs @@ -9,7 +9,6 @@ using Shoko.Server.API.v3.Helpers; using Shoko.Server.API.v3.Models.Common; using Shoko.Server.API.v3.Models.Shoko; -using Shoko.Server.Extensions; using Shoko.Server.Models; using Shoko.Server.Repositories; @@ -49,7 +48,7 @@ public ActionResult> GetSubFilters([FromRoute] int filterID, return RepoFactory.GroupFilter.GetByParentID(filterID) .Where(filter => showHidden || filter.InvisibleInClients != 1) - .OrderByName() + .OrderBy(filter => filter.GroupFilterName) .ToListResult(filter => new Filter(HttpContext, filter), page, pageSize); } @@ -72,7 +71,7 @@ public ActionResult> GetFilteredGroups([FromRoute] int filterI var user = User; groups = RepoFactory.AnimeGroup.GetAll() .Where(group => !group.AnimeGroupParentID.HasValue && user.AllowedGroup(group)) - .OrderByName(); + .OrderBy(group => group.GroupName); } else { @@ -196,7 +195,7 @@ public ActionResult> GetSeriesInFilteredGroup([FromRoute] int filte return (recursive ? group.GetAllSeries() : group.GetSeries()) .Where(series => seriesIDs.Contains(series.AnimeSeriesID)) - .OrderByAirDate() + .OrderBy(series => series.GetAnime()?.AirDate ?? DateTime.MaxValue) .Select(series => new Series(HttpContext, series)) .Where(series => series.Size > 0 || includeMissing) .ToList(); @@ -235,7 +234,7 @@ public ActionResult> GetSubGroups([FromRoute] int groupID, [FromQuer return includeEmpty || group.GetAllSeries().Any(s => s.GetAnimeEpisodes().Any(e => e.GetVideoLocals().Count > 0)); }) - .OrderByName() + .OrderBy(group => group.GroupName) .Select(group => new Group(HttpContext, group, randomImages)) .ToList(); } @@ -263,7 +262,7 @@ public ActionResult> GetSeriesInGroup([FromRoute] int groupID, [Fro var user = User; return (recursive ? group.GetAllSeries() : group.GetSeries()) .Where(a => user.AllowedSeries(a)) - .OrderByAirDate() + .OrderBy(series => series.GetAnime()?.AirDate ?? DateTime.MaxValue) .Select(series => new Series(HttpContext, series, randomImages)) .Where(series => series.Size > 0 || includeMissing) .ToList(); diff --git a/Shoko.Server/Extensions/IEnumerableExtenions.cs b/Shoko.Server/Extensions/IEnumerableExtenions.cs deleted file mode 100644 index 2cbc22657..000000000 --- a/Shoko.Server/Extensions/IEnumerableExtenions.cs +++ /dev/null @@ -1,27 +0,0 @@ - -using System; -using System.Collections.Generic; -using System.Linq; -using Shoko.Server.Models; - -namespace Shoko.Server.Extensions -{ - - public static class IEnumerableExtensions - { - public static IOrderedEnumerable OrderByAirDate(this IEnumerable enumerable) - { - return enumerable.OrderBy(series => series.GetAnime()?.AirDate ?? DateTime.MaxValue); - } - - public static IOrderedEnumerable OrderByName(this IEnumerable enumerable) - { - return enumerable.OrderBy(group => group.GroupName); - } - - public static IOrderedEnumerable OrderByName(this IEnumerable enumerable) - { - return enumerable.OrderBy(filter => filter.GroupFilterName); - } - } -} \ No newline at end of file diff --git a/Shoko.Server/Models/SVR_AnimeGroup.cs b/Shoko.Server/Models/SVR_AnimeGroup.cs index c99156ca8..650f63c6c 100644 --- a/Shoko.Server/Models/SVR_AnimeGroup.cs +++ b/Shoko.Server/Models/SVR_AnimeGroup.cs @@ -312,7 +312,7 @@ public SVR_AnimeSeries GetMainSeries() // Earliest airing series. return GetAllSeries() - .OrderByAirDate() + .OrderBy(series => series.GetAnime()?.AirDate ?? DateTime.MaxValue) .FirstOrDefault(); }