Skip to content

Commit

Permalink
Better Backwards Compat for Rating Conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
da3dsoul committed Oct 5, 2023
1 parent 003a32e commit 0fb8b8c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Shoko.Server/Filters/Legacy/LegacyConditionConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -709,8 +711,14 @@ public static List<GroupFilterSortingCriteria> 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;

Expand Down Expand Up @@ -898,7 +906,7 @@ public static SortingExpression GetSortingExpression(List<GroupFilterSortingCrit
{
Descending = criteria.SortDirection == GroupFilterSortDirection.Desc
},
GroupFilterSorting.AniDBRating => new HighestAniDBRatingSortingSelector
GroupFilterSorting.AniDBRating => new AverageAniDBRatingSortingSelector
{
Descending = criteria.SortDirection == GroupFilterSortDirection.Desc
},
Expand Down

0 comments on commit 0fb8b8c

Please sign in to comment.