forked from ddrilling/AsbCloudServer
Fix DetectedOperationService:
Restore TelemetryDataBaseService:
This commit is contained in:
parent
b1fc181477
commit
2c3f1de8a4
@ -11,7 +11,6 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AsbCloudInfrastructure.Services.DetectOperations.Detectors;
|
||||
using AsbCloudInfrastructure.Services.SAUB;
|
||||
|
||||
namespace AsbCloudInfrastructure.Services.DetectOperations;
|
||||
|
||||
@ -20,6 +19,7 @@ public class DetectedOperationService : IDetectedOperationService
|
||||
private readonly IDetectedOperationRepository operationRepository;
|
||||
private readonly IWellOperationCategoryRepository wellOperationCategoryRepository;
|
||||
private readonly IWellService wellService;
|
||||
private readonly ITelemetryService telemetryService;
|
||||
private readonly IRepositoryWellRelated<OperationValueDto> operationValueRepository;
|
||||
private readonly IScheduleRepository scheduleRepository;
|
||||
private readonly ITelemetryDataSaubService telemetryDataSaubService;
|
||||
@ -34,6 +34,7 @@ public class DetectedOperationService : IDetectedOperationService
|
||||
IDetectedOperationRepository operationRepository,
|
||||
IWellOperationCategoryRepository wellOperationCategoryRepository,
|
||||
IWellService wellService,
|
||||
ITelemetryService telemetryService,
|
||||
IRepositoryWellRelated<OperationValueDto> operationValueRepository,
|
||||
IScheduleRepository scheduleRepository,
|
||||
ITelemetryDataSaubService telemetryDataSaubService)
|
||||
@ -41,6 +42,7 @@ public class DetectedOperationService : IDetectedOperationService
|
||||
this.operationRepository = operationRepository;
|
||||
this.wellOperationCategoryRepository = wellOperationCategoryRepository;
|
||||
this.wellService = wellService;
|
||||
this.telemetryService = telemetryService;
|
||||
this.operationValueRepository = operationValueRepository;
|
||||
this.scheduleRepository = scheduleRepository;
|
||||
this.telemetryDataSaubService = telemetryDataSaubService;
|
||||
@ -143,6 +145,7 @@ public class DetectedOperationService : IDetectedOperationService
|
||||
const int minOperationLength = 5;
|
||||
const int maxDetectorsInterpolationFrameLength = 30;
|
||||
const int gap = maxDetectorsInterpolationFrameLength + minOperationLength;
|
||||
var timezone = telemetryService.GetTimezone(idTelemetry);
|
||||
|
||||
while (true)
|
||||
{
|
||||
@ -153,13 +156,12 @@ public class DetectedOperationService : IDetectedOperationService
|
||||
Order = 0
|
||||
};
|
||||
|
||||
var detectableTelemetries = (await telemetryDataSaubService.GetByTelemetryAsync(idTelemetry, request, token))
|
||||
var dtos = await telemetryDataSaubService.GetByTelemetryAsync(idTelemetry, request, token);
|
||||
var detectableTelemetries = dtos
|
||||
.Where(t => t.BlockPosition >= 0)
|
||||
.Select(t => t as TelemetryNewDataSaubDto)
|
||||
.Where (t => t is not null)
|
||||
.Select(t => new DetectableTelemetry
|
||||
{
|
||||
DateTime = t.DateTime,
|
||||
DateTime = new DateTimeOffset(t.DateTime, timezone.Offset),
|
||||
IdUser = t.IdUser,
|
||||
Mode = t.Mode,
|
||||
WellDepth = t.WellDepth,
|
||||
|
@ -129,10 +129,10 @@ public class TelemetryDataSaubService : TelemetryDataBaseService<TelemetryDataSa
|
||||
|
||||
protected override TelemetryDataSaubDto Convert(TelemetryDataSaub src, double timezoneOffset)
|
||||
{
|
||||
var dto = src.Adapt<TelemetryNewDataSaubDto>();
|
||||
var dto = src.Adapt<TelemetryDataSaubDto>();
|
||||
var telemetryUser = telemetryUserService.GetOrDefault(src.IdTelemetry, src.IdUser ?? int.MinValue);
|
||||
dto.User = telemetryUser?.MakeDisplayName();
|
||||
dto.DateTime = src.DateTime.ToOffset(TimeSpan.FromHours(timezoneOffset)); // src.DateTime.ToRemoteDateTime(timezoneOffset);
|
||||
dto.DateTime = src.DateTime.ToRemoteDateTime(timezoneOffset);
|
||||
dto.BitDepth = src.BitDepth <= src.WellDepth
|
||||
? src.BitDepth
|
||||
: src.WellDepth;
|
||||
|
Loading…
Reference in New Issue
Block a user