From 63b606086faed114ad281d4132c58ca3d5dd8a68 Mon Sep 17 00:00:00 2001 From: Flaminel Date: Wed, 21 Oct 2026 21:28:11 +0300 Subject: [PATCH] fixed preview funnel counting the previous cycle --- .../Features/Seeker/SeekerPreviewControllerTests.cs | 2 ++ .../Features/Seeker/Controllers/SeekerPreviewController.cs | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/code/backend/Cleanuparr.Api.Tests/Features/Seeker/SeekerPreviewControllerTests.cs b/code/backend/Cleanuparr.Api.Tests/Features/Seeker/SeekerPreviewControllerTests.cs index 843a36ab..afb9279b 100644 --- a/code/backend/Cleanuparr.Api.Tests/Features/Seeker/SeekerPreviewControllerTests.cs +++ b/code/backend/Cleanuparr.Api.Tests/Features/Seeker/SeekerPreviewControllerTests.cs @@ -247,6 +247,8 @@ public class SeekerPreviewControllerTests : IDisposable response.CycleWaitingUntil.ShouldBeNull(); response.NextUp.Count.ShouldBe(2); response.Excluded.ShouldBeEmpty(); + response.Funnel.RemainingUnits.ShouldBe(2); + response.Funnel.SearchedUnits.ShouldBe(0); } [Fact] diff --git a/code/backend/Cleanuparr.Api/Features/Seeker/Controllers/SeekerPreviewController.cs b/code/backend/Cleanuparr.Api/Features/Seeker/Controllers/SeekerPreviewController.cs index 771b0429..3d6feaff 100644 --- a/code/backend/Cleanuparr.Api/Features/Seeker/Controllers/SeekerPreviewController.cs +++ b/code/backend/Cleanuparr.Api/Features/Seeker/Controllers/SeekerPreviewController.cs @@ -114,7 +114,6 @@ public sealed class SeekerPreviewController : ControllerBase return this.ProblemResult(StatusCodes.Status502BadGateway, "Seeker needs Radarr v5.6 or newer"); } - InstanceFunnelStat funnel = ToFunnel(evaluation); DateTimeOffset? waitingUntil = null; // Same rollover as the Seeker job: a cycle with nothing left waits out the minimum cycle time, then starts over. @@ -131,6 +130,8 @@ public sealed class SeekerPreviewController : ControllerBase } } + InstanceFunnelStat funnel = ToFunnel(evaluation); + List nextUp = waitingUntil is null ? SeekerUnitEvaluator.SelectNext(evaluation, config.SelectionStrategy, NextUpCount) : [];