From e064343539c17452c6031d97ddd9c1c6b4cf5871 Mon Sep 17 00:00:00 2001 From: Aleksander Lund Date: Mon, 2 Sep 2024 11:19:21 +0200 Subject: [PATCH] Filter out product positions from GetPersonnelAllocation --- .../Queries/GetPersonnelAllocation.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/backend/api/Fusion.Resources.Domain/Queries/GetPersonnelAllocation.cs b/src/backend/api/Fusion.Resources.Domain/Queries/GetPersonnelAllocation.cs index e1b1fc25a..67d86687a 100644 --- a/src/backend/api/Fusion.Resources.Domain/Queries/GetPersonnelAllocation.cs +++ b/src/backend/api/Fusion.Resources.Domain/Queries/GetPersonnelAllocation.cs @@ -34,7 +34,7 @@ public class Handler : IRequestHandler logger, ResourcesDbContext db, IHttpClientFactory httpClientFactory, IMediator mediator, IFusionProfileResolver profileResolver) { this.logger = logger; @@ -64,12 +64,18 @@ public Handler(ILogger logger, ResourcesDbContext db, IHttpClientFactor personWithAllocations.Absence = absence.Select(a => new QueryPersonAbsenceBasic(a)).ToList(); + personWithAllocations.PositionInstances = personWithAllocations.PositionInstances + .Where(instance => instance.BasePosition != null + && instance.BasePosition.ProjectType != null + && !instance.BasePosition.ProjectType.Equals("Product")) + .ToList(); + if (!request.includeCurrentAllocations) return personWithAllocations; personWithAllocations.PositionInstances = personWithAllocations.PositionInstances - .Where(instance => instance.AppliesTo >= DateTime.Now && instance.AppliesFrom <= DateTime.Now) - .ToList(); + .Where(instance => instance.AppliesTo >= DateTime.Now && instance.AppliesFrom <= DateTime.Now) + .ToList(); personWithAllocations.Absence = personWithAllocations.Absence .Where(instance => (instance.AppliesTo == null || instance.AppliesTo >= DateTime.Now) && instance.AppliesFrom <= DateTime.Now)