diff --git a/AsbCloudInfrastructure/Services/DetectOperations/OperationDetectionBackgroundService.cs b/AsbCloudInfrastructure/Services/DetectOperations/OperationDetectionBackgroundService.cs index ead356ca..e4a6867b 100644 --- a/AsbCloudInfrastructure/Services/DetectOperations/OperationDetectionBackgroundService.cs +++ b/AsbCloudInfrastructure/Services/DetectOperations/OperationDetectionBackgroundService.cs @@ -173,7 +173,14 @@ namespace AsbCloudInfrastructure.Services.DetectOperations if (!isDetected) { - startDate = startDate.AddSeconds(0.95 * take); + var i = skip - minFragmentLength; + i = i > data.Length + ? data.Length - minStepLength + : i; + i = i < minFragmentLength + ? minFragmentLength + : i; + startDate = data[i].DateTime; } }