From a91d4888e62503f3db0b19f0b868bd9eb84be4d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B5=D0=BF=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94?= =?UTF-8?q?=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9?= Date: Wed, 10 Apr 2024 09:09:48 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=BF=D1=82=D0=B8=D0=BC=D0=B8=D0=B7?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F=20=D0=BF=D0=BE=D0=BB=D1=83=D1=87=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D1=8D=D0=BB=D0=B5=D0=BC=D0=B5=D0=BD=D1=82?= =?UTF-8?q?=D0=BE=D0=B2=20Wits?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Repository/GtrWitsRepository.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/AsbCloudInfrastructure/Repository/GtrWitsRepository.cs b/AsbCloudInfrastructure/Repository/GtrWitsRepository.cs index 022532f2..57b36ef2 100644 --- a/AsbCloudInfrastructure/Repository/GtrWitsRepository.cs +++ b/AsbCloudInfrastructure/Repository/GtrWitsRepository.cs @@ -12,6 +12,7 @@ using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; +using AsbCloudApp.Exceptions; using AsbCloudApp.Requests; using Mapster; @@ -19,7 +20,7 @@ namespace AsbCloudInfrastructure.Repository { public class GtrWitsRepository : IGtrRepository { - private static IDictionary<(int, int), string> WitsParameters = new Dictionary<(int, int), string> + private static IDictionary<(int IdRecord, int IdItem), string> WitsParameters = new Dictionary<(int, int), string> { { (1, 8), nameof(GtrWitsDto.DEPTBITM) }, { (1, 10), nameof(GtrWitsDto.DEPTMEAS) }, @@ -90,8 +91,10 @@ namespace AsbCloudInfrastructure.Repository if (telemetry is null) return Enumerable.Empty(); - var timezone = telemetryService.GetTimezone(telemetry.Id); - var timezoneOffset = TimeSpan.FromHours(timezone.Hours); + if (telemetry.TimeZone is null) + throw new ArgumentInvalidException(nameof(idWell),$"Telemetry id: {telemetry.Id} can't find timezone"); + + var timezoneOffset = TimeSpan.FromHours(telemetry.TimeZone.Hours); var query = BuildQuery(telemetry.Id, request); @@ -100,7 +103,10 @@ namespace AsbCloudInfrastructure.Repository var interval = TimeSpan.FromSeconds(10); + var idsRecord = WitsParameters.Select(p => p.Key.IdRecord); + var entities = await query + .Where(e => idsRecord.Contains(e.IdRecord)) .OrderBy(e => e.DateTime) .AsNoTracking() .ToArrayAsync(token);