Фикс репозиториев

This commit is contained in:
Степанов Дмитрий 2024-07-26 14:20:46 +03:00
parent 0c7aac40ff
commit b6b1220561
6 changed files with 21 additions and 48 deletions

View File

@ -55,14 +55,4 @@ public class TelemetryDataRequest
/// </summary> /// </summary>
[Range(1, MaxTake)] [Range(1, MaxTake)]
public int Take { get; set; } = 1024; public int Take { get; set; } = 1024;
/// <summary>
/// Больше или равно высоте талевого блока
/// </summary>
public double? GeBlockPosition { get; set; }
/// <summary>
/// Меньше или равно высоте талевого блока
/// </summary>
public double? LeBlockPosition { get; set; }
} }

View File

@ -36,15 +36,10 @@ public class DetectedOperationRepository
IdTelemetry = g.Key, IdTelemetry = g.Key,
LastDetectedOperation = g.OrderBy(o => o.DateEnd).Last() 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 => var dtos = entities.ToDictionary(x => x.IdTelemetry,
{ x => Convert(x.LastDetectedOperation));
if (x.Value == null)
throw new ArgumentNullException(nameof(x.Value), "The value of the last detected operation cannot be null");
return Convert(x.Value);
});
return dtos; return dtos;
} }

View File

@ -204,19 +204,21 @@ public class DetectedOperationService : IDetectedOperationService
var detectedOperations = new List<DetectedOperationDto>(); var detectedOperations = new List<DetectedOperationDto>();
var detectableTelemetries = telemetries.Select(t => new DetectableTelemetry var detectableTelemetries = telemetries
{ .Where(t => t.BlockPosition >= 0)
DateTime = new DateTimeOffset(t.DateTime, timezone.Offset), .Select(t => new DetectableTelemetry
IdUser = t.IdUser, {
Mode = t.Mode, DateTime = new DateTimeOffset(t.DateTime, timezone.Offset),
WellDepth = t.WellDepth, IdUser = t.IdUser,
Pressure = t.Pressure, Mode = t.Mode,
HookWeight = t.HookWeight, WellDepth = t.WellDepth,
BlockPosition = t.BlockPosition, Pressure = t.Pressure,
BitDepth = t.BitDepth, HookWeight = t.HookWeight,
RotorSpeed = t.RotorSpeed, BlockPosition = t.BlockPosition,
AxialLoad = t.AxialLoad, BitDepth = t.BitDepth,
}).ToArray(); RotorSpeed = t.RotorSpeed,
AxialLoad = t.AxialLoad,
}).ToArray();
var positionBegin = 0; var positionBegin = 0;
var positionEnd = detectableTelemetries.Length - gap; var positionEnd = detectableTelemetries.Length - gap;

View File

@ -74,8 +74,7 @@ public class WorkOperationDetection : Work
{ {
GeDate = dateBegin, GeDate = dateBegin,
Take = pointsCount, Take = pointsCount,
Order = 0, Order = 0
GeBlockPosition = 0
}; };
var detectedOperations = var detectedOperations =

View File

@ -176,7 +176,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
return dtos; return dtos;
} }
protected virtual IQueryable<TEntity> BuildQuery(int idTelemetry, TelemetryDataRequest request) private IQueryable<TEntity> BuildQuery(int idTelemetry, TelemetryDataRequest request)
{ {
var dbSet = db.Set<TEntity>(); var dbSet = db.Set<TEntity>();

View File

@ -176,17 +176,4 @@ public class TelemetryDataSaubService : TelemetryDataBaseService<TelemetryDataSa
outStream.Seek(0, SeekOrigin.Begin); outStream.Seek(0, SeekOrigin.Begin);
return outStream; return outStream;
} }
}
protected override IQueryable<TelemetryDataSaub> 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;
}
}