From 46cb325406e07fb1dca28b8f3cbf401733d46607 Mon Sep 17 00:00:00 2001 From: Qstick Date: Wed, 20 Feb 2019 21:39:12 -0500 Subject: [PATCH] Fixed: Groups must contain multiple qualities --- .../Profiles/Quality/QualityItemsValidator.cs | 10 +++++----- .../Profiles/Quality/QualityProfileModule.cs | 2 -- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Lidarr.Api.V1/Profiles/Quality/QualityItemsValidator.cs b/src/Lidarr.Api.V1/Profiles/Quality/QualityItemsValidator.cs index 411aea579..24b765218 100644 --- a/src/Lidarr.Api.V1/Profiles/Quality/QualityItemsValidator.cs +++ b/src/Lidarr.Api.V1/Profiles/Quality/QualityItemsValidator.cs @@ -13,7 +13,7 @@ namespace Lidarr.Api.V1.Profiles.Quality ruleBuilder.SetValidator(new NotEmptyValidator(null)); ruleBuilder.SetValidator(new AllowedValidator()); ruleBuilder.SetValidator(new QualityNameValidator()); - ruleBuilder.SetValidator(new EmptyItemGroupNameValidator()); + ruleBuilder.SetValidator(new GroupItemValidator()); ruleBuilder.SetValidator(new ItemGroupIdValidator()); ruleBuilder.SetValidator(new UniqueIdValidator()); ruleBuilder.SetValidator(new UniqueQualityIdValidator()); @@ -47,10 +47,10 @@ namespace Lidarr.Api.V1.Profiles.Quality } } - public class EmptyItemGroupNameValidator : PropertyValidator + public class GroupItemValidator : PropertyValidator { - public EmptyItemGroupNameValidator() - : base("Groups must not be empty") + public GroupItemValidator() + : base("Groups must contain multiple qualities") { } @@ -59,7 +59,7 @@ namespace Lidarr.Api.V1.Profiles.Quality { var items = context.PropertyValue as IList; - if (items.Any(i => i.Name.IsNotNullOrWhiteSpace() && i.Items.Empty())) + if (items.Any(i => i.Name.IsNotNullOrWhiteSpace() && i.Items.Count <= 1)) { return false; } diff --git a/src/Lidarr.Api.V1/Profiles/Quality/QualityProfileModule.cs b/src/Lidarr.Api.V1/Profiles/Quality/QualityProfileModule.cs index 2febd47ad..dbb8b5b63 100644 --- a/src/Lidarr.Api.V1/Profiles/Quality/QualityProfileModule.cs +++ b/src/Lidarr.Api.V1/Profiles/Quality/QualityProfileModule.cs @@ -13,8 +13,6 @@ namespace Lidarr.Api.V1.Profiles.Quality { _profileService = profileService; SharedValidator.RuleFor(c => c.Name).NotEmpty(); - // TODO: Need to validate the cutoff is allowed and the ID/quality ID exists - // TODO: Need to validate the Items to ensure groups have names and at no item has no name, no items and no quality SharedValidator.RuleFor(c => c.Cutoff).ValidCutoff(); SharedValidator.RuleFor(c => c.Items).ValidItems();