aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/Reports/ReportsService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Api/Reports/ReportsService.cs')
-rw-r--r--MediaBrowser.Api/Reports/ReportsService.cs73
1 files changed, 12 insertions, 61 deletions
diff --git a/MediaBrowser.Api/Reports/ReportsService.cs b/MediaBrowser.Api/Reports/ReportsService.cs
index 5b492d8b4..5dc6e2d84 100644
--- a/MediaBrowser.Api/Reports/ReportsService.cs
+++ b/MediaBrowser.Api/Reports/ReportsService.cs
@@ -338,6 +338,18 @@ namespace MediaBrowser.Api.Reports
query.LocationTypes = request.LocationTypes.Split(',').Select(d => (LocationType)Enum.Parse(typeof(LocationType), d, true)).ToArray();
}
+ // Min official rating
+ if (!string.IsNullOrEmpty(request.MinOfficialRating))
+ {
+ query.MinParentalRating = _localization.GetRatingLevel(request.MinOfficialRating);
+ }
+
+ // Max official rating
+ if (!string.IsNullOrEmpty(request.MaxOfficialRating))
+ {
+ query.MaxParentalRating = _localization.GetRatingLevel(request.MinOfficialRating);
+ }
+
if (request.HasQueryLimit == false)
{
query.StartIndex = null;
@@ -417,67 +429,6 @@ namespace MediaBrowser.Api.Reports
return false;
}
- // Min index number
- if (request.MinIndexNumber.HasValue)
- {
- if (!(i.IndexNumber.HasValue && i.IndexNumber.Value >= request.MinIndexNumber.Value))
- {
- return false;
- }
- }
-
- // Min official rating
- if (!string.IsNullOrEmpty(request.MinOfficialRating))
- {
- var level = _localization.GetRatingLevel(request.MinOfficialRating);
-
- if (level.HasValue)
- {
- var rating = i.CustomRating;
-
- if (string.IsNullOrEmpty(rating))
- {
- rating = i.OfficialRating;
- }
-
- if (!string.IsNullOrEmpty(rating))
- {
- var itemLevel = _localization.GetRatingLevel(rating);
-
- if (!(!itemLevel.HasValue || itemLevel.Value >= level.Value))
- {
- return false;
- }
- }
- }
- }
-
- // Max official rating
- if (!string.IsNullOrEmpty(request.MaxOfficialRating))
- {
- var level = _localization.GetRatingLevel(request.MaxOfficialRating);
-
- if (level.HasValue)
- {
- var rating = i.CustomRating;
-
- if (string.IsNullOrEmpty(rating))
- {
- rating = i.OfficialRating;
- }
-
- if (!string.IsNullOrEmpty(rating))
- {
- var itemLevel = _localization.GetRatingLevel(rating);
-
- if (!(!itemLevel.HasValue || itemLevel.Value <= level.Value))
- {
- return false;
- }
- }
- }
- }
-
return true;
}