From 1f172d5623921a2d84880ce705cdee3193a70df6 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Fri, 13 Aug 2021 16:24:29 -0400 Subject: [PATCH] Make the crossing_ways hash less strict Previously it was including a lot of data about the edge, and a very specific crossing location. This meant that any tiny perturbation in the crossing ways would generate a new issue hash, effectively "fixing" the old crossing issue and creating a new one. --- modules/validations/crossing_ways.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/modules/validations/crossing_ways.js b/modules/validations/crossing_ways.js index e39d5a8e0..789d6c135 100644 --- a/modules/validations/crossing_ways.js +++ b/modules/validations/crossing_ways.js @@ -8,7 +8,7 @@ import { geoAngle, geoExtent, geoLatToMeters, geoLonToMeters, geoLineIntersectio import { osmNode } from '../osm/node'; import { osmFlowingWaterwayTagValues, osmPathHighwayTagValues, osmRailwayTrackTagValues, osmRoutableHighwayTagValues } from '../osm/tags'; import { t } from '../core/localizer'; -import { utilDisplayLabel, utilHashcode } from '../util'; +import { utilDisplayLabel } from '../util'; import { validationIssue, validationIssueFix } from '../core/validation'; @@ -395,10 +395,8 @@ export function validationCrossingWays(context) { crossingTypeID += '_connectable'; } - // include crossing point, edges (sorted for determinism), and connection tags - var uniqueID = crossing.crossPoint.toString() + - edges.slice().sort(function(edge1, edge2) { return edge1[0] < edge2[0] ? -1 : 1; }).toString() + - JSON.stringify(connectionTags); + // Differentiate based on the loc rounded to 4 digits, since two ways can cross multiple times. + var uniqueID = '' + crossing.crossPoint[0].toFixed(4) + ',' + crossing.crossPoint[1].toFixed(4); return new validationIssue({ type: type, @@ -422,8 +420,7 @@ export function validationCrossingWays(context) { featureTypes: featureTypes, connectionTags: connectionTags }, - // differentiate based on the loc since two ways can cross multiple times - hash: utilHashcode(uniqueID), + hash: uniqueID, loc: crossing.crossPoint, dynamicFixes: function(context) { var mode = context.mode();