From bd5260edd176b6c3b838ffe99d3a726b530ca328 Mon Sep 17 00:00:00 2001 From: "ai.astrakhantsev" Date: Thu, 16 Feb 2023 11:54:05 +0500 Subject: [PATCH 1/3] #8636739 tests --- .../Services/TrajectoryVisualizationService.cs | 7 +++++-- .../ServicesTests/TrajectoryVisualizationServiceTest.cs | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/AsbCloudInfrastructure/Services/TrajectoryVisualizationService.cs b/AsbCloudInfrastructure/Services/TrajectoryVisualizationService.cs index ee40b693..56e02565 100644 --- a/AsbCloudInfrastructure/Services/TrajectoryVisualizationService.cs +++ b/AsbCloudInfrastructure/Services/TrajectoryVisualizationService.cs @@ -20,11 +20,14 @@ namespace AsbCloudInfrastructure.Services public async Task> GetTrajectoryAsync(int idWell, CancellationToken token) { - var result = new List(); + var result = new List { + new () + }; var dtos = (await repository.GetAsync(idWell, token)).ToArray(); var prevData = dtos[0]; var prevCoordinates = new TrajectoryVisualizationDto(); + for (var i = 1; i < dtos.Length; i++) { var data = dtos[i]; @@ -38,7 +41,7 @@ namespace AsbCloudInfrastructure.Services { X = x, Y = y, - Z = z + Z = z * -1 }; result.Add(coordinates); diff --git a/AsbCloudWebApi.Tests/ServicesTests/TrajectoryVisualizationServiceTest.cs b/AsbCloudWebApi.Tests/ServicesTests/TrajectoryVisualizationServiceTest.cs index 7ba99ce0..914a374c 100644 --- a/AsbCloudWebApi.Tests/ServicesTests/TrajectoryVisualizationServiceTest.cs +++ b/AsbCloudWebApi.Tests/ServicesTests/TrajectoryVisualizationServiceTest.cs @@ -73,7 +73,7 @@ namespace AsbCloudWebApi.Tests.ServicesTests { new() { AzimuthGeo = 0d, ZenithAngle = 0d, WellboreDepth = 0d}, new() { AzimuthGeo = 30d, ZenithAngle = 30d, WellboreDepth = 10d}, - new() { AzimuthGeo = 0d, ZenithAngle = 0d, WellboreDepth = 20d}, + new() { AzimuthGeo = 20d, ZenithAngle = 20d, WellboreDepth = 20d}, }; var mock = MakePlannedTrajectoryRepositoryMock(plannedTrajectory); From d852fb36405665126ad8375deb30086ab86c5457 Mon Sep 17 00:00:00 2001 From: "ai.astrakhantsev" Date: Mon, 20 Feb 2023 11:12:39 +0500 Subject: [PATCH 2/3] #8636739 data --- .../Services/TrajectoryVisualizationService.cs | 8 ++++---- .../ServicesTests/TrajectoryVisualizationServiceTest.cs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/AsbCloudInfrastructure/Services/TrajectoryVisualizationService.cs b/AsbCloudInfrastructure/Services/TrajectoryVisualizationService.cs index 56e02565..1c90e8d8 100644 --- a/AsbCloudInfrastructure/Services/TrajectoryVisualizationService.cs +++ b/AsbCloudInfrastructure/Services/TrajectoryVisualizationService.cs @@ -32,9 +32,9 @@ namespace AsbCloudInfrastructure.Services { var data = dtos[i]; var flat = GetFlat(data.WellboreDepth, prevData.WellboreDepth, prevData.ZenithAngle); - var x = prevCoordinates.X = GetX(data.AzimuthGeo, flat, prevCoordinates.X); - var y = prevCoordinates.Y = GetY(data.AzimuthGeo, flat, prevCoordinates.X); - var z = prevCoordinates.Z = GetZ(data.WellboreDepth, prevData.WellboreDepth, data.ZenithAngle, prevCoordinates.Z); + var x = prevCoordinates.X = GetX(prevData.AzimuthGeo, flat, prevCoordinates.X); + var y = prevCoordinates.Y = GetY(prevData.AzimuthGeo, flat, prevCoordinates.X); + var z = prevCoordinates.Z = GetZ(data.WellboreDepth, prevData.WellboreDepth, prevData.ZenithAngle, prevCoordinates.Z); prevData = data; var coordinates = new TrajectoryVisualizationDto @@ -50,7 +50,7 @@ namespace AsbCloudInfrastructure.Services return result; } - private double GetFlat(double depthEnd, double depthStart, double zenit) => + private double GetFlat(double depthEnd, double depthStart, double zenit) => (depthEnd - depthStart) * Math.Sin(zenit * Math.PI / 180); private double GetX(double azimuth, double flat, double prev) => diff --git a/AsbCloudWebApi.Tests/ServicesTests/TrajectoryVisualizationServiceTest.cs b/AsbCloudWebApi.Tests/ServicesTests/TrajectoryVisualizationServiceTest.cs index 914a374c..7ba99ce0 100644 --- a/AsbCloudWebApi.Tests/ServicesTests/TrajectoryVisualizationServiceTest.cs +++ b/AsbCloudWebApi.Tests/ServicesTests/TrajectoryVisualizationServiceTest.cs @@ -73,7 +73,7 @@ namespace AsbCloudWebApi.Tests.ServicesTests { new() { AzimuthGeo = 0d, ZenithAngle = 0d, WellboreDepth = 0d}, new() { AzimuthGeo = 30d, ZenithAngle = 30d, WellboreDepth = 10d}, - new() { AzimuthGeo = 20d, ZenithAngle = 20d, WellboreDepth = 20d}, + new() { AzimuthGeo = 0d, ZenithAngle = 0d, WellboreDepth = 20d}, }; var mock = MakePlannedTrajectoryRepositoryMock(plannedTrajectory); From 25cbdc911c23b7032237a08c75cc825f18824e35 Mon Sep 17 00:00:00 2001 From: "ai.astrakhantsev" Date: Mon, 20 Feb 2023 11:16:24 +0500 Subject: [PATCH 3/3] #8636739 --- .../Services/TrajectoryVisualizationService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AsbCloudInfrastructure/Services/TrajectoryVisualizationService.cs b/AsbCloudInfrastructure/Services/TrajectoryVisualizationService.cs index 1c90e8d8..dc54f49d 100644 --- a/AsbCloudInfrastructure/Services/TrajectoryVisualizationService.cs +++ b/AsbCloudInfrastructure/Services/TrajectoryVisualizationService.cs @@ -41,7 +41,7 @@ namespace AsbCloudInfrastructure.Services { X = x, Y = y, - Z = z * -1 + Z = z }; result.Add(coordinates); @@ -60,6 +60,6 @@ namespace AsbCloudInfrastructure.Services prev + flat * Math.Cos(azimuth * Math.PI / 180); private double GetZ(double depthEnd, double depthStart, double zenit, double prev) => - prev - (depthEnd - depthStart) * Math.Cos(zenit * Math.PI / 180); + prev + (depthEnd - depthStart) * Math.Cos(zenit * Math.PI / 180); } }