Fix filter

This commit is contained in:
ngfrolov 2022-04-29 15:54:01 +05:00
parent 93156ef6f8
commit 3c67d22bbd
4 changed files with 15 additions and 10 deletions

View File

@ -67,13 +67,13 @@ namespace AsbCloudInfrastructure.Services.DetectOperations
query = query.Where(o => o.DateStart >= request.GtDate.Value.ToUtcDateTimeOffset(well.Timezone.Hours));
if (request.LtDate is not null)
query = query.Where(o => o.DateStart <= request.LtDate.Value.ToUtcDateTimeOffset(well.Timezone.Hours));
query = query.Where(o => o.DateEnd <= request.LtDate.Value.ToUtcDateTimeOffset(well.Timezone.Hours));
if (request.GtDepth is not null)
query = query.Where(o => o.DepthStart >= request.GtDepth);
if (request.LtDepth is not null)
query = query.Where(o => o.DepthStart <= request.LtDepth);
query = query.Where(o => o.DepthEnd <= request.LtDepth);
if (request.EqIdTelemetryUser is not null)
query = query.Where(o => o.IdUsersAtStart == request.EqIdTelemetryUser);

View File

@ -1,9 +1,4 @@
using AsbCloudDb.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AsbCloudInfrastructure.Services.DetectOperations
{
@ -39,12 +34,18 @@ namespace AsbCloudInfrastructure.Services.DetectOperations
{
if (DetectEnd(telemetry, skip))
{
var dateStart = telemetry[position].DateTime;
var dateEnd = telemetry[skip].DateTime;
var durationSec = (dateEnd - dateStart).TotalSeconds;
if (durationSec < MinDurationSeconds || durationSec > MaxDurationSeconds)
return null;
var result = new DetectedOperation
{
IdCategory = IdCategory,
IdUsersAtStart = telemetry[position].IdUser ?? -1,
DateStart = telemetry[position].DateTime,
DateEnd = telemetry[skip].DateTime,
DateStart = dateStart,
DateEnd = dateEnd,
DepthStart = telemetry[position].WellDepth ?? -1d,
DepthEnd = telemetry[skip].WellDepth ?? -1d,
};

View File

@ -0,0 +1,5 @@
# Сервис определения операций по данным телеметрии
Классы:
**DetectableTelemetry** - обертка над классами телеметрий, которые можно проанализировать.