Skip to content

Commit

Permalink
Fixed: Revert seed criteria validation to warnings
Browse files Browse the repository at this point in the history
Closes #1692
  • Loading branch information
mynameisbogdan committed May 28, 2023
1 parent 5864a09 commit 3ae1917
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/NzbDrone.Core/Indexers/IndexerTorrentBaseSettings.cs
@@ -1,5 +1,6 @@
using FluentValidation;
using NzbDrone.Core.Annotations;
using NzbDrone.Core.Validation;

namespace NzbDrone.Core.Indexers
{
Expand All @@ -9,47 +10,48 @@ public IndexerTorrentSettingsValidator(double seedRatioMinimum = 0.0, int seedTi
{
RuleFor(c => c.AppMinimumSeeders).GreaterThan(0)
.When(c => c.AppMinimumSeeders.HasValue)
.WithMessage("Should be greater than zero");
.AsWarning().WithMessage("Should be greater than zero");

RuleFor(c => c.SeedRatio).GreaterThan(0.0)
.When(c => c.SeedRatio.HasValue)
.WithMessage("Should be greater than zero");
.AsWarning().WithMessage("Should be greater than zero");

RuleFor(c => c.SeedTime).GreaterThan(0)
.When(c => c.SeedTime.HasValue)
.WithMessage("Should be greater than zero");
.AsWarning().WithMessage("Should be greater than zero");

RuleFor(c => c.PackSeedTime).GreaterThan(0)
.When(c => c.PackSeedTime.HasValue)
.WithMessage("Should be greater than zero");
.AsWarning().WithMessage("Should be greater than zero");

if (seedRatioMinimum != 0.0)
{
RuleFor(c => c.SeedRatio).GreaterThanOrEqualTo(seedRatioMinimum)
.When(c => c.SeedRatio > 0.0)
.AsWarning()
.WithMessage($"Under {seedRatioMinimum} leads to H&R");
}

if (seedTimeMinimum != 0)
{
RuleFor(c => c.SeedTime).GreaterThanOrEqualTo(seedTimeMinimum)
.When(c => c.SeedTime > 0)
.AsWarning()
.WithMessage($"Under {seedTimeMinimum} leads to H&R");
}

if (seasonPackSeedTimeMinimum != 0)
{
RuleFor(c => c.PackSeedTime).GreaterThanOrEqualTo(seasonPackSeedTimeMinimum)
.When(c => c.PackSeedTime > 0)
.AsWarning()
.WithMessage($"Under {seasonPackSeedTimeMinimum} leads to H&R");
}
}
}

public class IndexerTorrentBaseSettings
{
private static readonly IndexerTorrentSettingsValidator Validator = new ();

[FieldDefinition(1, Type = FieldType.Number, Label = "Apps Minimum Seeders", HelpText = "Minimum seeders required by the Applications for the indexer to grab, empty is Sync profile's default", Advanced = true)]
public int? AppMinimumSeeders { get; set; }

Expand Down

0 comments on commit 3ae1917

Please sign in to comment.