Improvements for minimum age

pull/4/head
Mark McDowall 10 years ago
parent 580f03a5bc
commit bf169eb139

@ -10,7 +10,7 @@ namespace NzbDrone.Api.Config
: base(configService)
{
SharedValidator.RuleFor(c => c.MinimumAge)
.GreaterThan(0);
.GreaterThanOrEqualTo(0);
SharedValidator.RuleFor(c => c.Retention)
.GreaterThanOrEqualTo(0);

@ -29,14 +29,23 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
var age = subject.Release.AgeMinutes;
var minimumAge = _configService.MinimumAge;
if (minimumAge == 0)
{
_logger.Debug("Minimum age is not set.");
return Decision.Accept();
}
_logger.Debug("Checking if report meets minimum age requirements. {0}", age);
if (minimumAge > 0 && age < minimumAge)
if (age < minimumAge)
{
_logger.Debug("Only {0} minutes old, minimum age is {1} minutes", age, minimumAge);
return Decision.Reject("Only {0} minutes old, minimum age is {1} minutes", age, minimumAge);
}
_logger.Debug("Release is {0} minutes old, greater than minimum age of {1} minutes", age, minimumAge);
return Decision.Accept();
}
}

@ -5,7 +5,7 @@
<label class="col-sm-3 control-label">Minimum Age</label>
<div class="col-sm-1 col-sm-push-2 help-inline">
<i class="icon-nd-form-info" title="Usenet only: Reports that do not meet minimum age will not be grabbed, until they do"/>
<i class="icon-nd-form-info" title="Usenet only: Minimum age of NZBs before they are grabbed. Use this to give new releases time to propagate to your usenet provider."/>
</div>
<div class="col-sm-2 col-sm-pull-1">

Loading…
Cancel
Save