From bdd9ed4c22eda5391c7703a6c2c5180fdd2ac649 Mon Sep 17 00:00:00 2001 From: pietervdvn Date: Tue, 9 Nov 2021 02:03:32 +0100 Subject: [PATCH] Small cleanups --- Logic/Osm/Changes.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Logic/Osm/Changes.ts b/Logic/Osm/Changes.ts index fd904e260..3b68dee1d 100644 --- a/Logic/Osm/Changes.ts +++ b/Logic/Osm/Changes.ts @@ -168,22 +168,18 @@ export class Changes { changedObjectCoordinates.push(...chng["coordinates"]) } } - - const leastDistance = Math.min(...changedObjectCoordinates.map(coor => + + return Math.min(...changedObjectCoordinates.map(coor => Math.min(...recentLocationPoints.map(gpsPoint => { const otherCoor = GeoOperations.centerpointCoordinates(gpsPoint) - const dist = GeoOperations.distanceBetween(coor, otherCoor) * 1000; - console.log("Comparing ", coor, "and ", otherCoor, " --> ", dist) - return dist + return GeoOperations.distanceBetween(coor, otherCoor) * 1000 })) )) - return leastDistance } public async applyAction(action: OsmChangeAction): Promise { const changeDescriptions = await action.Perform(this) - const distanceToObject = this.calculateDistanceToChanges(action, changeDescriptions) - changeDescriptions[0].meta.distanceToObject = distanceToObject + changeDescriptions[0].meta.distanceToObject = this.calculateDistanceToChanges(action, changeDescriptions) this.applyChanges(changeDescriptions) } @@ -313,7 +309,7 @@ export class Changes { pendingPerTheme.get(theme).push(changeDescription) } - const successes = await Promise.all(Array.from(pendingPerTheme, ([key, value]) => value) + const successes = await Promise.all(Array.from(pendingPerTheme, ([_, value]) => value) .map(async pendingChanges => { try { return await self.flushSelectChanges(pendingChanges);