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) {