From 5bf30956c8983e8592cf58f41767246a67aefb08 Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Mon, 1 Apr 2024 16:11:20 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B0=20=D1=80?= =?UTF-8?q?=D0=B0=D1=81=D1=87=D0=B5=D1=82=D0=B0=20=D1=81=D0=B2=D0=BE=D0=B4?= =?UTF-8?q?=D0=BD=D0=BE=D0=B9=20=D1=81=D1=82=D0=B0=D1=82=D0=B8=D1=81=D1=82?= =?UTF-8?q?=D0=B8=D0=BA=D0=B8=20=D0=BF=D0=BE=20=D0=B1=D1=83=D1=80=D0=B8?= =?UTF-8?q?=D0=BB=D1=8C=D1=89=D0=B8=D0=BA=D0=B0=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/Subsystems/SubsystemService.cs | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/AsbCloudInfrastructure/Services/Subsystems/SubsystemService.cs b/AsbCloudInfrastructure/Services/Subsystems/SubsystemService.cs index ed2571a9..a6b28866 100644 --- a/AsbCloudInfrastructure/Services/Subsystems/SubsystemService.cs +++ b/AsbCloudInfrastructure/Services/Subsystems/SubsystemService.cs @@ -57,7 +57,7 @@ internal class SubsystemService : ISubsystemService var result = new List(); var schedulePage = await scheduleRepository.GetPageAsync(request, token); var wells = await wellService.GetAsync(new WellRequest { Ids = request.IdsWells }, token); - + foreach (var schedule in schedulePage) { var idWell = schedule.IdWell; @@ -68,21 +68,15 @@ internal class SubsystemService : ISubsystemService var detectedOperations = await detectedOperationService .GetOperationsAsync(byWellRequest, token); - var groupByDriller = detectedOperations - .Where(operation => operation.Driller is not null) - .GroupBy(operation => operation.Driller); - - foreach (var entry in groupByDriller) + var detectedOperationsByCurrentDriller = detectedOperations.Where(d => d.Driller?.Id == schedule.IdDriller); + var drillerOperationsStat = await CalcStatAsync(detectedOperationsByCurrentDriller, token); + var dto = new DrillerDetectedOperationStatDto { - var drillerOperationsStat = await CalcStatAsync(entry, token); - var dto = new DrillerDetectedOperationStatDto - { - Statistic = drillerOperationsStat, - Schedule = schedule, - Well = well, - }; - result.Add(dto); - } + Statistic = drillerOperationsStat, + Schedule = schedule, + Well = well, + }; + result.Add(dto); } return result;