From 4391b460fa033ea5794c55a2dd45d01277951617 Mon Sep 17 00:00:00 2001 From: Mikhail Kuznetsov Date: Wed, 24 Sep 2025 10:34:05 +1000 Subject: [PATCH] =?UTF-8?q?fix(dal):=20=D0=B2=20UnitFilter=20=D0=B4=D0=BE?= =?UTF-8?q?=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=BE=20=D0=BD=D0=B5=D0=BE?= =?UTF-8?q?=D0=B1=D1=8F=D0=B7=D0=B0=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D0=BE?= =?UTF-8?q?=D0=B5=20=D0=BE=D0=B3=D1=80=D0=B0=D0=BD=D0=B8=D1=87=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BD=D0=B0=20=D0=BA=D0=BE=D0=BB=D0=B8=D1=87?= =?UTF-8?q?=D0=B5=D1=81=D1=82=D0=B2=D0=BE=20=D1=81=D1=82=D1=80=D0=BE=D0=BA?= =?UTF-8?q?=20=D0=B2=20=D0=B2=D1=8B=D0=B4=D0=B0=D0=B2=D0=B0=D0=B5=D0=BC?= =?UTF-8?q?=D0=BE=D0=BC=20=D1=81=D0=BF=D0=B8=D1=81=D0=BA=D0=B5=20=D0=AD?= =?UTF-8?q?=D0=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DomainServices/Implementations/UnitFilterService.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/PARR.DAL/DomainServices/Implementations/UnitFilterService.cs b/PARR.DAL/DomainServices/Implementations/UnitFilterService.cs index 5a237d16..b062e3cf 100644 --- a/PARR.DAL/DomainServices/Implementations/UnitFilterService.cs +++ b/PARR.DAL/DomainServices/Implementations/UnitFilterService.cs @@ -78,6 +78,9 @@ namespace PARR.DAL.DomainServices.Implementations foreach (var unitFilter in job.UnitFilters) { + if (takeCount.HasValue && result.Count() > takeCount.Value) + break; + var query = baseQuery.Where(t => EF.Functions.ILike(t.Name, unitFilter.UnitFilter)); foreach (var fieldFilter in unitFilter.FieldFilters) @@ -113,13 +116,13 @@ namespace PARR.DAL.DomainServices.Implementations query = query.Where(t => t.ChildUnits.Count() >= job.MinValueRelationships && t.ChildUnits.Count() <= job.MaxValueRelationships); } - if (takeCount.HasValue) - query = query.Take(takeCount.Value); - var newUnits = await query.Select(t => t.Id).ToListAsync(); result.AddRange(newUnits); } + if (takeCount.HasValue && result.Count() > takeCount.Value) + result = result.Take(takeCount.Value).ToList(); + return result; }