From 83f709c4a3e4c1922a3700153bc72ea351d9bdd0 Mon Sep 17 00:00:00 2001 From: Ken-ichi Ueda Date: Mon, 29 Jul 2024 14:21:02 -0700 Subject: [PATCH] ObsEdit location test uses required acc, no desired --- src/components/LocationPicker/LocationPicker.js | 4 +--- src/components/LocationPicker/LocationPickerContainer.js | 7 ++++--- src/components/ObsEdit/EvidenceSectionContainer.js | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/components/LocationPicker/LocationPicker.js b/src/components/LocationPicker/LocationPicker.js index c9db63fd4..37d61d1fd 100644 --- a/src/components/LocationPicker/LocationPicker.js +++ b/src/components/LocationPicker/LocationPicker.js @@ -20,7 +20,7 @@ import LoadingIndicator from "./LoadingIndicator"; import LocationSearch from "./LocationSearch"; export const DESIRED_LOCATION_ACCURACY = 100; -export const REQUIRED_LOCATION_ACCURACY = 500000; +export const REQUIRED_LOCATION_ACCURACY = 500_000; type Props = { accuracy: number, @@ -62,8 +62,6 @@ const LocationPicker = ( { // prevent initial map render from resetting the coordinates and locationName const [initialMapRender, setInitialMapRender] = useState( true ); - console.log( "[DEBUG LocationPicker.js] rendering" ); - return ( diff --git a/src/components/LocationPicker/LocationPickerContainer.js b/src/components/LocationPicker/LocationPickerContainer.js index 496779356..4d1687728 100644 --- a/src/components/LocationPicker/LocationPickerContainer.js +++ b/src/components/LocationPicker/LocationPickerContainer.js @@ -12,14 +12,15 @@ import { Dimensions } from "react-native"; import fetchPlaceName from "sharedHelpers/fetchPlaceName"; import useStore from "stores/useStore"; -import LocationPicker from "./LocationPicker"; +import LocationPicker, { + DESIRED_LOCATION_ACCURACY, + REQUIRED_LOCATION_ACCURACY +} from "./LocationPicker"; const { width } = Dimensions.get( "screen" ); const DELTA = 0.02; const CROSSHAIRLENGTH = 254; -export const DESIRED_LOCATION_ACCURACY = 100; -export const REQUIRED_LOCATION_ACCURACY = 500000; const estimatedAccuracy = longitudeDelta => longitudeDelta * 1000 * ( ( CROSSHAIRLENGTH / width ) * 100 ); diff --git a/src/components/ObsEdit/EvidenceSectionContainer.js b/src/components/ObsEdit/EvidenceSectionContainer.js index 1277a2f08..0b3832393 100644 --- a/src/components/ObsEdit/EvidenceSectionContainer.js +++ b/src/components/ObsEdit/EvidenceSectionContainer.js @@ -1,6 +1,6 @@ // @flow -import { DESIRED_LOCATION_ACCURACY } from "components/LocationPicker/LocationPicker"; +import { REQUIRED_LOCATION_ACCURACY } from "components/LocationPicker/LocationPicker"; import { differenceInCalendarYears, isFuture, @@ -65,7 +65,7 @@ const EvidenceSectionContainer = ( { const positionalAccuracyBlank = isNil( currentObservation?.positional_accuracy ); const positionalAccuracyDesireable = ( currentObservation?.positional_accuracy || 0 - ) <= DESIRED_LOCATION_ACCURACY; + ) <= REQUIRED_LOCATION_ACCURACY; let validPositionalAccuracy = ( positionalAccuracyBlank || positionalAccuracyDesireable ); if ( isNewObs && hasImportedPhotos ) {