From d38819494bec2ff7da24ec4104a7c5d115dd3f73 Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Fri, 9 Aug 2024 15:22:29 +0300 Subject: [PATCH 1/3] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D1=80=D0=B5=D0=B3=D1=83=D0=BB=D1=8F=D1=80?= =?UTF-8?q?=D0=BD=D0=BE=D0=B5=20=D0=B2=D1=8B=D1=80=D0=B0=D0=B6=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B4=D0=BB=D1=8F=20=D0=BF=D0=BE=D0=BB=D1=8F=20?= =?UTF-8?q?email=20=D0=B2=20=D0=BA=D0=BE=D0=BD=D1=82=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=B0=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudApp/Data/User/ContactDto.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AsbCloudApp/Data/User/ContactDto.cs b/AsbCloudApp/Data/User/ContactDto.cs index dd6b3212..8445d801 100644 --- a/AsbCloudApp/Data/User/ContactDto.cs +++ b/AsbCloudApp/Data/User/ContactDto.cs @@ -35,7 +35,7 @@ public class ContactDto : IId /// /// Email /// - [RegularExpression(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$", ErrorMessage = "Некорректный email")] + [RegularExpression(@"^[a-zA-Z0-9_\-\.]{3,128}@[a-zA-Z0-9_\-\.]{2,128}\.[a-zA-Z]{1,32}$", ErrorMessage = "Некорректный email")] public string? Email { get; set; } /// From d6b4f90f4c57ffa2c851562f70cc9169dd4a6da4 Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Fri, 9 Aug 2024 16:04:20 +0300 Subject: [PATCH 2/3] =?UTF-8?q?=D0=A1=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20?= =?UTF-8?q?=D1=81=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE=D1=81?= =?UTF-8?q?=D1=82=D1=8C=D1=8E=20=D0=BE=D1=82=D0=BA=D0=B0=D1=82=D0=B0=20?= =?UTF-8?q?=D1=82=D1=80=D0=B0=D0=BD=D0=B7=D0=B0=D1=86=D0=B8=D0=B8=20=D0=B2?= =?UTF-8?q?=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=D0=B5=20Insert=20=D0=B2=20Cha?= =?UTF-8?q?ngeLogRepositoryAbstract?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Repository/ChangeLogRepositoryAbstract.cs | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/AsbCloudInfrastructure/Repository/ChangeLogRepositoryAbstract.cs b/AsbCloudInfrastructure/Repository/ChangeLogRepositoryAbstract.cs index 157b204d..c47ebd05 100644 --- a/AsbCloudInfrastructure/Repository/ChangeLogRepositoryAbstract.cs +++ b/AsbCloudInfrastructure/Repository/ChangeLogRepositoryAbstract.cs @@ -117,6 +117,22 @@ public abstract class ChangeLogRepositoryAbstract : ICh } public async Task InsertRange(int idUser, IEnumerable dtos, CancellationToken token) + { + using var transaction = db.Database.BeginTransaction(); + try + { + var result = await InsertRangeWithoutTransaction(idUser, dtos, token); + await transaction.CommitAsync(token); + return result; + } + catch + { + await transaction.RollbackAsync(token); + throw; + } + } + + private async Task InsertRangeWithoutTransaction(int idUser, IEnumerable dtos, CancellationToken token) { var result = 0; if (dtos.Any()) @@ -138,7 +154,8 @@ public abstract class ChangeLogRepositoryAbstract : ICh result += await SaveChangesWithExceptionHandling(token); } - return result; + + return result; } public async Task UpdateRange(int idUser, IEnumerable dtos, CancellationToken token) @@ -248,7 +265,7 @@ public abstract class ChangeLogRepositoryAbstract : ICh try { result += await Clear(idUser, request, token); - result += await InsertRange(idUser, dtos, token); + result += await InsertRangeWithoutTransaction(idUser, dtos, token); await transaction.CommitAsync(token); return result; From d1716fa01bbea626a134e2eb16ea70c1cef1f0c9 Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Tue, 13 Aug 2024 10:18:27 +0500 Subject: [PATCH 3/3] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B0=20?= =?UTF-8?q?=D1=80=D0=B0=D1=81=D1=87=D0=B5=D1=82=D0=B0=20=D0=B4=D0=B0=D0=BD?= =?UTF-8?q?=D0=BD=D1=8B=D1=85=20=D0=B4=D0=BB=D1=8F=20=D0=BF=D0=BE=D1=81?= =?UTF-8?q?=D1=82=D1=80=D0=BE=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B3=D1=80=D0=B0?= =?UTF-8?q?=D1=84=D0=B8=D0=BA=D0=B0=20=D1=82=D0=B2=D0=B4=20(=D0=B4=D0=BD?= =?UTF-8?q?=D0=B8=20=D1=81=D0=BE=20=D1=81=D1=82=D0=B0=D1=80=D1=82=D0=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OperationsStatService.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/AsbCloudInfrastructure/Services/WellOperationService/OperationsStatService.cs b/AsbCloudInfrastructure/Services/WellOperationService/OperationsStatService.cs index 07146882..b1756101 100644 --- a/AsbCloudInfrastructure/Services/WellOperationService/OperationsStatService.cs +++ b/AsbCloudInfrastructure/Services/WellOperationService/OperationsStatService.cs @@ -431,6 +431,10 @@ public class OperationsStatService : IOperationsStatService int? iLastMatch = null; int iLastFact = 0; var nptHours = 0d; + + DateTimeOffset? firstDateStartFact = Fact!.DateStart; + DateTimeOffset? firstDateStartPlan = Plan?.DateStart; + for (int i = 0; i < wellOperations.Length; i++) { var item = wellOperations[i]; @@ -441,7 +445,13 @@ public class OperationsStatService : IOperationsStatService if (plan is not null) { planFactPredict.Plan = Convert(plan, tzOffsetHours); - planFactPredict.Plan.Day = (planFactPredict.Plan.DateStart - dateStart).TotalDays; + + if (!firstDateStartPlan.HasValue) { + firstDateStartPlan = planFactPredict.Plan.DateStart; + } + + planFactPredict.Plan.Day = (planFactPredict.Plan.DateStart - firstDateStartPlan.Value).TotalDays; + if (fact is not null) iLastMatch = i; } @@ -451,8 +461,9 @@ public class OperationsStatService : IOperationsStatService if(WellOperationCategory.NonProductiveTimeSubIds.Contains(fact.IdCategory)) nptHours += fact.DurationHours; - planFactPredict.Fact = Convert(fact, tzOffsetHours); - planFactPredict.Fact.Day = (planFactPredict.Fact.DateStart - dateStart).TotalDays; + planFactPredict.Fact = Convert(fact, tzOffsetHours); + planFactPredict.Fact.Day = (planFactPredict.Fact.DateStart - firstDateStartFact.Value).TotalDays; + planFactPredict.Fact.NptHours = nptHours; iLastFact = i; }