From b86808175803a199209d209d4181a075a809cc8c Mon Sep 17 00:00:00 2001 From: Rune Nielsen Date: Wed, 5 Aug 2020 15:49:36 +0200 Subject: [PATCH] do not rollback on node moved on previous connected segment --- .../Factories/RouteNodeEventFactory.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/OpenFTTH.GDBIntegrator.Integrator/Factories/RouteNodeEventFactory.cs b/src/OpenFTTH.GDBIntegrator.Integrator/Factories/RouteNodeEventFactory.cs index 7e18982..e5da476 100644 --- a/src/OpenFTTH.GDBIntegrator.Integrator/Factories/RouteNodeEventFactory.cs +++ b/src/OpenFTTH.GDBIntegrator.Integrator/Factories/RouteNodeEventFactory.cs @@ -1,5 +1,6 @@ using System; using System.Threading.Tasks; +using System.Linq; using OpenFTTH.GDBIntegrator.RouteNetwork; using OpenFTTH.GDBIntegrator.Integrator.Notifications; using OpenFTTH.GDBIntegrator.Config; @@ -37,8 +38,11 @@ public async Task CreateUpdatedEvent(RouteNode before, RouteNode await _geoDatabase.UpdateRouteNodeShadowTable(after); - var intersectingRouteSegments = await _geoDatabase.GetIntersectingRouteSegments(after); + var previousIntersectingRouteSegments = await _geoDatabase.GetIntersectingRouteSegments(before.Coord); + var intersectingRouteSegments = (await _geoDatabase.GetIntersectingRouteSegments(after)) + .Where(x => !previousIntersectingRouteSegments.Any(y => y.Mrid == x.Mrid)).ToList(); var intersectingRouteNodes = await _geoDatabase.GetIntersectingRouteNodes(after); + if (intersectingRouteSegments.Count > 0 || intersectingRouteNodes.Count > 0) return new RollbackInvalidRouteNodeOperation(before);