diff --git a/AsbCloudApp/Requests/TelemetryRequest.cs b/AsbCloudApp/Requests/TelemetryRequest.cs index e8f88a90..04d4ffb4 100644 --- a/AsbCloudApp/Requests/TelemetryRequest.cs +++ b/AsbCloudApp/Requests/TelemetryRequest.cs @@ -55,14 +55,4 @@ public class TelemetryDataRequest /// [Range(1, MaxTake)] public int Take { get; set; } = 1024; - - /// - /// Больше или равно высоте талевого блока - /// - public double? GeBlockPosition { get; set; } - - /// - /// Меньше или равно высоте талевого блока - /// - public double? LeBlockPosition { get; set; } } diff --git a/AsbCloudInfrastructure/Repository/DetectedOperationRepository.cs b/AsbCloudInfrastructure/Repository/DetectedOperationRepository.cs index 2dfd0eac..7d664066 100644 --- a/AsbCloudInfrastructure/Repository/DetectedOperationRepository.cs +++ b/AsbCloudInfrastructure/Repository/DetectedOperationRepository.cs @@ -36,15 +36,10 @@ public class DetectedOperationRepository IdTelemetry = g.Key, LastDetectedOperation = g.OrderBy(o => o.DateEnd).Last() }) - .ToDictionaryAsync(x => x.IdTelemetry, x => x.LastDetectedOperation, token); + .ToArrayAsync(token); - var dtos = entities.ToDictionary(x => x.Key, x => - { - if (x.Value == null) - throw new ArgumentNullException(nameof(x.Value), "The value of the last detected operation cannot be null"); - - return Convert(x.Value); - }); + var dtos = entities.ToDictionary(x => x.IdTelemetry, + x => Convert(x.LastDetectedOperation)); return dtos; } diff --git a/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationService.cs b/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationService.cs index 30d83ecd..4b21ca96 100644 --- a/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationService.cs +++ b/AsbCloudInfrastructure/Services/DetectOperations/DetectedOperationService.cs @@ -204,19 +204,21 @@ public class DetectedOperationService : IDetectedOperationService var detectedOperations = new List(); - var detectableTelemetries = telemetries.Select(t => new DetectableTelemetry - { - DateTime = new DateTimeOffset(t.DateTime, timezone.Offset), - IdUser = t.IdUser, - Mode = t.Mode, - WellDepth = t.WellDepth, - Pressure = t.Pressure, - HookWeight = t.HookWeight, - BlockPosition = t.BlockPosition, - BitDepth = t.BitDepth, - RotorSpeed = t.RotorSpeed, - AxialLoad = t.AxialLoad, - }).ToArray(); + var detectableTelemetries = telemetries + .Where(t => t.BlockPosition >= 0) + .Select(t => new DetectableTelemetry + { + DateTime = new DateTimeOffset(t.DateTime, timezone.Offset), + IdUser = t.IdUser, + Mode = t.Mode, + WellDepth = t.WellDepth, + Pressure = t.Pressure, + HookWeight = t.HookWeight, + BlockPosition = t.BlockPosition, + BitDepth = t.BitDepth, + RotorSpeed = t.RotorSpeed, + AxialLoad = t.AxialLoad, + }).ToArray(); var positionBegin = 0; var positionEnd = detectableTelemetries.Length - gap; diff --git a/AsbCloudInfrastructure/Services/DetectOperations/WorkOperationDetection.cs b/AsbCloudInfrastructure/Services/DetectOperations/WorkOperationDetection.cs index d00be734..e4ae3eb4 100644 --- a/AsbCloudInfrastructure/Services/DetectOperations/WorkOperationDetection.cs +++ b/AsbCloudInfrastructure/Services/DetectOperations/WorkOperationDetection.cs @@ -74,8 +74,7 @@ public class WorkOperationDetection : Work { GeDate = dateBegin, Take = pointsCount, - Order = 0, - GeBlockPosition = 0 + Order = 0 }; var detectedOperations = diff --git a/AsbCloudInfrastructure/Services/SAUB/TelemetryDataBaseService.cs b/AsbCloudInfrastructure/Services/SAUB/TelemetryDataBaseService.cs index 8d2b369c..3dbb2e58 100644 --- a/AsbCloudInfrastructure/Services/SAUB/TelemetryDataBaseService.cs +++ b/AsbCloudInfrastructure/Services/SAUB/TelemetryDataBaseService.cs @@ -176,7 +176,7 @@ namespace AsbCloudInfrastructure.Services.SAUB return dtos; } - protected virtual IQueryable BuildQuery(int idTelemetry, TelemetryDataRequest request) + private IQueryable BuildQuery(int idTelemetry, TelemetryDataRequest request) { var dbSet = db.Set(); diff --git a/AsbCloudInfrastructure/Services/SAUB/TelemetryDataSaubService.cs b/AsbCloudInfrastructure/Services/SAUB/TelemetryDataSaubService.cs index 8541caee..2516bd65 100644 --- a/AsbCloudInfrastructure/Services/SAUB/TelemetryDataSaubService.cs +++ b/AsbCloudInfrastructure/Services/SAUB/TelemetryDataSaubService.cs @@ -176,17 +176,4 @@ public class TelemetryDataSaubService : TelemetryDataBaseService BuildQuery(int idTelemetry, TelemetryDataRequest request) - { - var query = base.BuildQuery(idTelemetry, request); - - if (request.GeBlockPosition.HasValue) - query = query.Where(e => e.BlockPosition >= request.GeBlockPosition); - - if (request.LeBlockPosition.HasValue) - query = query.Where(e => e.BlockPosition <= request.LeBlockPosition); - - return query; - } -} +} \ No newline at end of file