From 27b67010d453714a12f64bd0519d07c4eada84f5 Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Mon, 1 Apr 2024 16:12:15 +0500 Subject: [PATCH] =?UTF-8?q?Revert=20"=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B0?= =?UTF-8?q?=20=D1=80=D0=B0=D1=81=D1=87=D0=B5=D1=82=D0=B0=20=D1=81=D0=B2?= =?UTF-8?q?=D0=BE=D0=B4=D0=BD=D0=BE=D0=B9=20=D1=81=D1=82=D0=B0=D1=82=D0=B8?= =?UTF-8?q?=D1=81=D1=82=D0=B8=D0=BA=D0=B8=20=D0=BF=D0=BE=20=D0=B1=D1=83?= =?UTF-8?q?=D1=80=D0=B8=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 This reverts commit 5bf30956c8983e8592cf58f41767246a67aefb08. --- .../Services/Subsystems/SubsystemService.cs | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/AsbCloudInfrastructure/Services/Subsystems/SubsystemService.cs b/AsbCloudInfrastructure/Services/Subsystems/SubsystemService.cs index a6b28866..ed2571a9 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,15 +68,21 @@ internal class SubsystemService : ISubsystemService var detectedOperations = await detectedOperationService .GetOperationsAsync(byWellRequest, token); - var detectedOperationsByCurrentDriller = detectedOperations.Where(d => d.Driller?.Id == schedule.IdDriller); - var drillerOperationsStat = await CalcStatAsync(detectedOperationsByCurrentDriller, token); - var dto = new DrillerDetectedOperationStatDto + var groupByDriller = detectedOperations + .Where(operation => operation.Driller is not null) + .GroupBy(operation => operation.Driller); + + foreach (var entry in groupByDriller) { - Statistic = drillerOperationsStat, - Schedule = schedule, - Well = well, - }; - result.Add(dto); + var drillerOperationsStat = await CalcStatAsync(entry, token); + var dto = new DrillerDetectedOperationStatDto + { + Statistic = drillerOperationsStat, + Schedule = schedule, + Well = well, + }; + result.Add(dto); + } } return result;