From 7d172129e654e0df7d3234b52d919d72582976f3 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: Mon, 2 Sep 2024 18:42:47 +0500 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=20=D1=81=D0=BE=D1=80?= =?UTF-8?q?=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=BA=D1=83=20=D0=BE=D0=BF=D0=B5?= =?UTF-8?q?=D1=80=D0=B0=D1=86=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WellOperationService/WellOperationService.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/AsbCloudInfrastructure/Services/WellOperationService/WellOperationService.cs b/AsbCloudInfrastructure/Services/WellOperationService/WellOperationService.cs index 17665e8c..750e99db 100644 --- a/AsbCloudInfrastructure/Services/WellOperationService/WellOperationService.cs +++ b/AsbCloudInfrastructure/Services/WellOperationService/WellOperationService.cs @@ -161,7 +161,7 @@ public class WellOperationService : IWellOperationService var groupedByWellAndTypeDtos = wellOperationsBaseDtos .GroupBy(e => new { e.IdWell, e.IdType }); - var result = new List(); + var wellOperations = new List(); var count = 0; foreach (var wellOperationsWithTypeDto in groupedByWellAndTypeDtos) { @@ -179,8 +179,6 @@ public class WellOperationService : IWellOperationService if (request.Take != null) filteredWellOperations = filteredWellOperations.Take((int)request.Take); - var timezoneOffset = wellService.GetTimezone(wellOperationsWithTypeDto.Key.IdWell).Offset; - var dtos = filteredWellOperations .Select(dto => { @@ -192,8 +190,13 @@ public class WellOperationService : IWellOperationService return newDto; }); - result.AddRange(dtos); + wellOperations.AddRange(dtos); } + + var result = + request.SortFields?.Any() is true ? + wellOperations.AsQueryable().SortBy(request.SortFields) : + wellOperations.AsQueryable().OrderBy(e => e.DateStart); return (result, count); } @@ -308,10 +311,6 @@ public class WellOperationService : IWellOperationService var leDateUtc = request.LeDate.Value.UtcDateTime; dtos = dtos.Where(e => e.DateStart <= leDateUtc); } - if (request.SortFields?.Any() is true) - dtos = dtos.AsQueryable().SortBy(request.SortFields); - else - dtos = dtos.AsQueryable().OrderBy(e => e.DateStart); return dtos; }