From 2e27211505078666ef06279f0a071424f05b8d5d Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Thu, 16 May 2024 13:19:11 +0500 Subject: [PATCH 1/2] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B0=20?= =?UTF-8?q?=D1=84=D0=B8=D0=BB=D1=8C=D1=82=D1=80=D0=B0=D1=86=D0=B8=D0=B8=20?= =?UTF-8?q?processMapPlanDrilling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/WellInfoService.cs | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/AsbCloudInfrastructure/Services/WellInfoService.cs b/AsbCloudInfrastructure/Services/WellInfoService.cs index 5d5f3bf3..9c407490 100644 --- a/AsbCloudInfrastructure/Services/WellInfoService.cs +++ b/AsbCloudInfrastructure/Services/WellInfoService.cs @@ -43,7 +43,10 @@ public class WellInfoService var wellsIds = activeWells.Select(w => w.Id); - var processMapPlanWellDrillingRequests = wellsIds.Select(id => new ProcessMapPlanBaseRequestWithWell(id)); + var processMapPlanWellDrillingRequests = wellsIds.Select(id => new ProcessMapPlanBaseRequestWithWell(id) + { + Moment = DateTimeOffset.UtcNow.AddDays(1) + }); var processMapPlanWellDrillings = new List(); foreach (var processMapPlanWellDrillingRequest in processMapPlanWellDrillingRequests) { @@ -97,14 +100,21 @@ public class WellInfoService int? idSection = wellLastFactSection?.Id; ProcessMapPlanDrillingDto? processMapPlanWellDrilling = null; - if (idSection.HasValue) + if(idSection.HasValue && currentDepth.HasValue) { - processMapPlanWellDrilling = wellProcessMaps.FirstOrDefault(p => p.IdWellSectionType == idSection); - } - else if (currentDepth.HasValue) + processMapPlanWellDrilling = wellProcessMaps + .Where(p => p.IdWellSectionType == idSection) + .Where(p => p.DepthStart <= currentDepth.Value && p.DepthEnd >= currentDepth.Value) + .FirstOrDefault(); + } + else if(currentDepth.HasValue) { processMapPlanWellDrilling = wellProcessMaps.FirstOrDefault(p => p.DepthStart <= currentDepth.Value && p.DepthEnd >= currentDepth.Value); } + else if (idSection.HasValue) + { + processMapPlanWellDrilling = wellProcessMaps.FirstOrDefault(p => p.IdWellSectionType == idSection); + } double? planTotalDepth = null; planTotalDepth = wellDepthByProcessMap.FirstOrDefault(p => p.Id == well.Id)?.DepthEnd; From 43b89b8db84847eb2502aa53476193e107f55f32 Mon Sep 17 00:00:00 2001 From: ngfrolov Date: Thu, 16 May 2024 15:10:21 +0500 Subject: [PATCH 2/2] =?UTF-8?q?Fix=20EFExtensions.ExecInsertOr*()=20=D0=BC?= =?UTF-8?q?=D0=B5=D1=82=D0=BE=D0=B4=D1=8B.=20=D0=9D=D0=B5=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=B8=D0=BB=D1=8C=D0=BD=D0=BE=20=D0=BE=D0=B1=D1=80?= =?UTF-8?q?=D0=B0=D0=B1=D0=B0=D1=82=D1=8B=D0=B2=D0=B0=D0=BB=D1=81=D1=8F=20?= =?UTF-8?q?null.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudDb/EFExtensions.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/AsbCloudDb/EFExtensions.cs b/AsbCloudDb/EFExtensions.cs index 4b8361e7..8829462a 100644 --- a/AsbCloudDb/EFExtensions.cs +++ b/AsbCloudDb/EFExtensions.cs @@ -223,6 +223,7 @@ namespace AsbCloudDb private static string FormatValue(object? v) => v switch { + null => "NULL", string vStr => $"'{EscapeCurlyBraces(vStr)}'", DateTime vDate => $"'{FormatDateValue(vDate)}'", DateTimeOffset vDate => $"'{FormatDateValue(vDate.UtcDateTime)}'",