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

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>
[Range(1, MaxTake)]
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,
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;
}

View File

@ -204,7 +204,9 @@ public class DetectedOperationService : IDetectedOperationService
var detectedOperations = new List<DetectedOperationDto>();
var detectableTelemetries = telemetries.Select(t => new DetectableTelemetry
var detectableTelemetries = telemetries
.Where(t => t.BlockPosition >= 0)
.Select(t => new DetectableTelemetry
{
DateTime = new DateTimeOffset(t.DateTime, timezone.Offset),
IdUser = t.IdUser,

View File

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

View File

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

View File

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