From 6c41a19f792c083af9b9978cc0b77606b2b3f6e4 Mon Sep 17 00:00:00 2001 From: miles-grant-ibigroup Date: Thu, 25 Apr 2024 13:50:12 -0400 Subject: [PATCH] address pr feedback --- env.example.yml | 2 +- serverless.yml | 2 +- utils.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/env.example.yml b/env.example.yml index 095f6a7..37992db 100644 --- a/env.example.yml +++ b/env.example.yml @@ -4,4 +4,4 @@ BUGSNAG_NOTIFIER_KEY: INSERT BUGSNAG NOTIFIER KEY HERE GEOCODERS: BACKUP_GEOCODERS: -LOCATION_COMPARISON_COORDIATE_ACCURACY: defaults to 4 (~10m). What accuracy to use when comparing if two locations are the same +LOCATION_COMPARISON_COORDINATE_PRECISION: defaults to 4 (~10m). What precision to use when comparing if two locations are the same diff --git a/serverless.yml b/serverless.yml index da12780..a9719f7 100644 --- a/serverless.yml +++ b/serverless.yml @@ -12,7 +12,7 @@ provider: GEOCODERS: ${self:custom.secrets.GEOCODERS} BACKUP_GEOCODERS: ${self:custom.secrets.BACKUP_GEOCODERS} BUGSNAG_NOTIFIER_KEY: ${self:custom.secrets.BUGSNAG_NOTIFIER_KEY} - LOCATION_COMPARISON_COORDIATE_ACCURACY: ${self:custom.secrets.LOCATION_COMPARISON_COORDIATE_ACCURACY, 4} + LOCATION_COMPARISON_COORDINATE_PRECISION: ${self:custom.secrets.LOCATION_COMPARISON_COORDINATE_PRECISION, 4} package: patterns: - pois.json diff --git a/utils.ts b/utils.ts index 0e211d1..e7f28ae 100644 --- a/utils.ts +++ b/utils.ts @@ -30,7 +30,7 @@ export type ServerlessResponse = { // Consts const PREFERRED_LAYERS = ['venue', 'address', 'street', 'intersection'] -const { LOCATION_COMPARISON_COORDIATE_ACCURACY } = process.env +const { LOCATION_COMPARISON_COORDINATE_PRECISION } = process.env /** * This method removes all characters Pelias doesn't support. @@ -182,7 +182,7 @@ const filterOutDuplicateStops = ( return arePointsRoughlyEqual( feature.geometry.coordinates, otherFeature.geometry.coordinates, - parseInt(LOCATION_COMPARISON_COORDIATE_ACCURACY || '') + !!LOCATION_COMPARISON_COORDINATE_PRECISION ? parseInt(LOCATION_COMPARISON_COORDINATE_PRECISION) : undefined ) }) }