From 0fb8b8c7031c8c64a95a9f6b5110eeaa373baccf Mon Sep 17 00:00:00 2001 From: da3dsoul Date: Wed, 4 Oct 2023 22:50:17 -0400 Subject: [PATCH] Better Backwards Compat for Rating Conditions --- .../Filters/Legacy/LegacyConditionConverter.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Shoko.Server/Filters/Legacy/LegacyConditionConverter.cs b/Shoko.Server/Filters/Legacy/LegacyConditionConverter.cs index 92f1e9ad7..f47e22c9b 100644 --- a/Shoko.Server/Filters/Legacy/LegacyConditionConverter.cs +++ b/Shoko.Server/Filters/Legacy/LegacyConditionConverter.cs @@ -569,7 +569,9 @@ private static bool IsEpisodeWatchedDate(FilterExpression expression, out object private static bool IsAniDBRating(FilterExpression expression, out object parameter, out GroupFilterOperator gfOperator) { - return TryParseComparator(expression, typeof(AverageAniDBRatingSelector), out parameter, out gfOperator); + return TryParseComparator(expression, typeof(AverageAniDBRatingSelector), out parameter, out gfOperator) || + TryParseComparator(expression, typeof(HighestAniDBRatingSelector), out parameter, out gfOperator) || + TryParseComparator(expression, typeof(LowestAniDBRatingSelector), out parameter, out gfOperator); } private static bool IsUserRating(FilterExpression expression, out object parameter, out GroupFilterOperator gfOperator) @@ -709,8 +711,14 @@ public static List GetSortingCriteriaList(FilterPres sortType = GroupFilterSorting.MissingEpisodeCount; else if (type == typeof(HighestUserRatingSortingSelector)) sortType = GroupFilterSorting.UserRating; + else if (type == typeof(LowestUserRatingSortingSelector)) + sortType = GroupFilterSorting.UserRating; + else if (type == typeof(AverageAniDBRatingSortingSelector)) + sortType = GroupFilterSorting.AniDBRating; else if (type == typeof(HighestAniDBRatingSortingSelector)) sortType = GroupFilterSorting.AniDBRating; + else if (type == typeof(LowestAniDBRatingSortingSelector)) + sortType = GroupFilterSorting.AniDBRating; else if (type == typeof(SortingNameSortingSelector)) sortType = GroupFilterSorting.SortName; @@ -898,7 +906,7 @@ public static SortingExpression GetSortingExpression(List new HighestAniDBRatingSortingSelector + GroupFilterSorting.AniDBRating => new AverageAniDBRatingSortingSelector { Descending = criteria.SortDirection == GroupFilterSortDirection.Desc },