TelemetryDataSaubService.GetTelemetryDataStatAsync(..) Add filterBy modes to query.

This commit is contained in:
ngfrolov 2023-04-05 13:35:05 +05:00
parent 0457f8dd98
commit 1dee254427
Signed by untrusted user who does not match committer: ng.frolov
GPG Key ID: E99907A0357B29A7

View File

@ -36,6 +36,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
{
var timezone = telemetryService.GetTimezone(idTelemetry);
var timezoneOffset = TimeSpan.FromHours(timezone.Hours);
int[] modes = new int[] { 0, 1, 3 };
var query = db.Set<TelemetryDataSaub>()
.Where(t => t.IdTelemetry == idTelemetry)
@ -43,6 +44,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
.Where(t => t.WellDepth > 0.0001)
.Where(t => t.WellDepth - t.BitDepth < 0.01)
.Where(t => t.Mode != null)
.Where(t => modes.Contains(t.Mode.Value))
.GroupBy(t => new {
t.DateTime.Hour,
WellDepthX10 = Math.Truncate(t.WellDepth!.Value * 10),
@ -51,7 +53,7 @@ namespace AsbCloudInfrastructure.Services.SAUB
.Select(g => new TelemetryDataSaubStatDto
{
Count = g.Count(),
Mode = g.Key.Mode??0,
IdMode = g.Key.Mode??0,
IdFeedRegulator = g.Key.IdFeedRegulator,
DateMin = DateTime.SpecifyKind(g.Min(t => t.DateTime.UtcDateTime) + timezoneOffset, DateTimeKind.Unspecified),