Fixed validation error for Seed Ratio on btn.

pull/2577/head
Taloth Saldono 7 years ago
parent 7388e8c2c2
commit b95c4d37d7

@ -12,13 +12,21 @@ namespace NzbDrone.Core.Indexers
{ {
public SeedCriteriaSettingsValidator(double seedRatioMinimum = 0.0, int seedTimeMinimum = 0, int seasonPackSeedTimeMinimum = 0) public SeedCriteriaSettingsValidator(double seedRatioMinimum = 0.0, int seedTimeMinimum = 0, int seasonPackSeedTimeMinimum = 0)
{ {
RuleFor(c => c.SeedRatio).GreaterThan(0.0).When(c => c.SeedRatio.HasValue).WithMessage("Must be greater than zero"); RuleFor(c => c.SeedRatio).GreaterThan(0.0)
RuleFor(c => c.SeedTime).GreaterThan(0).When(c => c.SeedTime.HasValue).WithMessage("Must be greater than zero"); .When(c => c.SeedRatio.HasValue)
RuleFor(c => c.SeasonPackSeedTime).GreaterThan(0).When(c => c.SeasonPackSeedTime.HasValue).WithMessage("Must be greater than zero"); .AsWarning().WithMessage("Should be greater than zero");
RuleFor(c => c.SeedTime).GreaterThan(0)
.When(c => c.SeedTime.HasValue)
.AsWarning().WithMessage("Should be greater than zero");
RuleFor(c => c.SeasonPackSeedTime).GreaterThan(0)
.When(c => c.SeasonPackSeedTime.HasValue)
.AsWarning().WithMessage("Should be greater than zero");
if (seedRatioMinimum != 0.0) if (seedRatioMinimum != 0.0)
{ {
RuleFor(c => c.SeedRatio).GreaterThan(seedRatioMinimum) RuleFor(c => c.SeedRatio).GreaterThanOrEqualTo(seedRatioMinimum)
.When(c => c.SeedRatio > 0.0) .When(c => c.SeedRatio > 0.0)
.AsWarning() .AsWarning()
.WithMessage($"Under {seedRatioMinimum} leads to H&R"); .WithMessage($"Under {seedRatioMinimum} leads to H&R");
@ -26,7 +34,7 @@ namespace NzbDrone.Core.Indexers
if (seedTimeMinimum != 0) if (seedTimeMinimum != 0)
{ {
RuleFor(c => c.SeedTime).GreaterThan(seedTimeMinimum) RuleFor(c => c.SeedTime).GreaterThanOrEqualTo(seedTimeMinimum)
.When(c => c.SeedTime > 0) .When(c => c.SeedTime > 0)
.AsWarning() .AsWarning()
.WithMessage($"Under {seedTimeMinimum} leads to H&R"); .WithMessage($"Under {seedTimeMinimum} leads to H&R");
@ -34,7 +42,7 @@ namespace NzbDrone.Core.Indexers
if (seasonPackSeedTimeMinimum != 0) if (seasonPackSeedTimeMinimum != 0)
{ {
RuleFor(c => c.SeasonPackSeedTime).GreaterThan(seasonPackSeedTimeMinimum) RuleFor(c => c.SeasonPackSeedTime).GreaterThanOrEqualTo(seasonPackSeedTimeMinimum)
.When(c => c.SeasonPackSeedTime > 0) .When(c => c.SeasonPackSeedTime > 0)
.AsWarning() .AsWarning()
.WithMessage($"Under {seasonPackSeedTimeMinimum} leads to H&R"); .WithMessage($"Under {seasonPackSeedTimeMinimum} leads to H&R");

Loading…
Cancel
Save