Fix queue rules upper bound to never allow 0 (#543)

This commit is contained in:
Flaminel
2026-04-03 16:11:12 +03:00
committed by GitHub
parent 81f6de03e7
commit ef280ec398
5 changed files with 32 additions and 10 deletions

View File

@@ -261,10 +261,10 @@
helpKey="queue-cleaner:stallRule.privacyType" />
<app-number-input label="Min Completion %" [(value)]="stallMinCompletion" [min]="0" [max]="100" suffix="%"
hint="Apply the rule once completion percentage exceeds this value (0 includes items at 0% and above)"
[error]="stallCompletionError()"
helpKey="queue-cleaner:stallRule.completionRange" />
<app-number-input label="Max Completion %" [(value)]="stallMaxCompletion" [min]="0" [max]="100" suffix="%"
<app-number-input label="Max Completion %" [(value)]="stallMaxCompletion" [min]="1" [max]="100" suffix="%"
hint="Apply the rule to items with a completion percentage less than or equal to this value"
[error]="stallCompletionError()"
helpKey="queue-cleaner:stallRule.completionRange" />
<app-toggle label="Reset Strikes on Progress" [(checked)]="stallResetOnProgress"
hint="Reset strike count when torrent shows progress"
@@ -314,10 +314,10 @@
helpKey="queue-cleaner:slowRule.privacyType" />
<app-number-input label="Min Completion %" [(value)]="slowMinCompletion" [min]="0" [max]="100" suffix="%"
hint="Apply the rule once completion percentage exceeds this value (0 still includes exactly 0%)"
[error]="slowCompletionError()"
helpKey="queue-cleaner:slowRule.completionRange" />
<app-number-input label="Max Completion %" [(value)]="slowMaxCompletion" [min]="0" [max]="100" suffix="%"
<app-number-input label="Max Completion %" [(value)]="slowMaxCompletion" [min]="1" [max]="100" suffix="%"
hint="Apply the rule up to and including this completion percentage"
[error]="slowCompletionError()"
helpKey="queue-cleaner:slowRule.completionRange" />
<app-size-input label="Ignore Above Size" [units]="sizeUnitsLarge" [(value)]="slowIgnoreAboveSize"
placeholder="e.g. 25"

View File

@@ -236,6 +236,7 @@ export class QueueCleanerComponent implements OnInit, HasPendingChanges {
readonly stallCompletionError = computed(() => {
const min = this.stallMinCompletion() ?? 0;
const max = this.stallMaxCompletion() ?? 100;
if (max <= 0) return 'Max percentage must be greater than 0';
if (max < min) return 'Max percentage must be greater than or equal to Min percentage';
return undefined;
});
@@ -256,6 +257,7 @@ export class QueueCleanerComponent implements OnInit, HasPendingChanges {
readonly slowCompletionError = computed(() => {
const min = this.slowMinCompletion() ?? 0;
const max = this.slowMaxCompletion() ?? 100;
if (max <= 0) return 'Max percentage must be greater than 0';
if (max < min) return 'Max percentage must be greater than or equal to Min percentage';
return undefined;
});