From a457da8ead6ef871263e8d10a7af33d636bd1bd6 Mon Sep 17 00:00:00 2001 From: eugeniy_ivanov Date: Thu, 22 Sep 2022 17:13:53 +0500 Subject: [PATCH] =?UTF-8?q?=D0=BD=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C=D1=88?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BA=D0=BE=D1=80=D1=80=D0=B5=D0=BA=D1=82=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=BA=D0=B8=20=D0=B8=D0=BD=D1=82=D0=B5=D1=80?= =?UTF-8?q?=D1=84=D0=B5=D0=B9=D1=81=D0=B0=20IDetectedOperationService=20?= =?UTF-8?q?=D0=B8=20=D1=81=D0=B5=D1=80=D0=B2=D0=B8=D1=81=D0=B0=20=D1=80?= =?UTF-8?q?=D0=B0=D1=81=D1=87=D0=B5=D1=82=D0=B0=20=D1=81=D1=82=D0=B0=D1=82?= =?UTF-8?q?=D0=B8=D1=81=D1=82=D0=B8=D0=BA=D0=B8=20=D0=BF=D0=BE=20=D0=BD?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BA=D0=B5=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=B4=D1=81=D0=B8=D1=81=D1=82=D0=B5=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/IDetectedOperationService.cs | 1 - .../SubsystemOperationTimeService.cs | 18 ++++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/AsbCloudApp/Services/IDetectedOperationService.cs b/AsbCloudApp/Services/IDetectedOperationService.cs index aaa5cc1c..14a05665 100644 --- a/AsbCloudApp/Services/IDetectedOperationService.cs +++ b/AsbCloudApp/Services/IDetectedOperationService.cs @@ -45,7 +45,6 @@ namespace AsbCloudApp.Services /// /// /// - Task DeleteAsync(DetectedOperationRequest request, CancellationToken token); /// diff --git a/AsbCloudInfrastructure/Services/Subsystems/SubsystemOperationTimeService.cs b/AsbCloudInfrastructure/Services/Subsystems/SubsystemOperationTimeService.cs index dd7b56ce..28405e81 100644 --- a/AsbCloudInfrastructure/Services/Subsystems/SubsystemOperationTimeService.cs +++ b/AsbCloudInfrastructure/Services/Subsystems/SubsystemOperationTimeService.cs @@ -97,6 +97,8 @@ namespace AsbCloudInfrastructure.Services.Subsystems GtDate = request.GtDate, }; var detectedOperations = await detectedOperationService.GetOperationsAsync(detectedOperationsRequest, token); + if(detectedOperations?.Any() != true) + return null; var depthInterval = GetDepthInterval(detectedOperations); var statList = CalcStat(data,depthInterval,request, token); @@ -150,20 +152,20 @@ namespace AsbCloudInfrastructure.Services.Subsystems return result; } - private (double,double) GetDepthInterval (IEnumerable? detectedOperations) + private (double depthIntervalRotor, double depthIntervalSlide) GetDepthInterval (IEnumerable detectedOperations) { - var depthInterval = (depthIntervalRotor:(double)0, depthIntervalSlide: (double)0); - if (detectedOperations is null) - return depthInterval; - depthInterval.depthIntervalRotor = detectedOperations.Where(o => o.IdCategory == 1) + + var depthIntervalRotor = detectedOperations.Where(o => o.IdCategory == 1) .Sum(o => o.DepthEnd - o.DepthStart); - depthInterval.depthIntervalSlide = detectedOperations.Where(o => o.IdCategory == 3) - .Sum(o => o.DepthEnd - o.DepthStart); + var depthIntervalSlide = detectedOperations.Where(o => o.IdCategory == 3) + .Sum(o => o.DepthEnd - o.DepthStart); + var depthInterval = (depthIntervalRotor, depthIntervalSlide); + return depthInterval; } private double GetDepthIntervalSubsystem(int idSubsystem, (double depthIntervalRotor, double depthIntervalSlide) depthInterval) { - double depthIntervalSubsystem = 0; + var depthIntervalSubsystem = 0d; //AKB - MSE if (idSubsystem == 1 | idSubsystem == 2) {