Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified functions in BatchUpdate.php file #139

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Edzelopez
Copy link
Member

Overview

A brief description of the pull request. Keep technical jargon to a minimum. Hyperlink relevant discussions.

Before

What is the old user-interface or technical-contract (as appropriate)?
For optimal clarity, include a concrete example such as a screenshot, GIF (LICEcap, SilentCast), or code-snippet.

After

What changed? What is new old user-interface or technical-contract?
For optimal clarity, include a concrete example such as a screenshot, GIF (LICEcap, SilentCast), or code-snippet.

Technical Details

If the PR involves technical details/changes/considerations which would not be manifest to a casual developer skimming the above sections, please describe the details here.

Comments

Anything else you would like the reviewer to note

@@ -234,6 +239,15 @@ public function processContacts($processGeocode, $parseStreetAddress) {
$unparseableContactAddress[] = " Contact ID: " . $dao->id . " <a href =\"$url\"> " . $dao->street_address . " </a> ";
// reset element values.
$parsedFields = array_fill_keys(array_keys($parsedFields), '');
/**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines should be moved to L219 in an else code block. This is because this part of the code is about street addressing parsing not geocoding

* If an address has failed in the geocoding scheduled job i.e. no lat/long is fetched, we will update the manual_geocode field to 1.
*/
$results = \Civi\Api4\Address::update()
->addValue('manual_geo_code', true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also this should be changed I think to be like

$addressParams = [
  'manual_geo_code' => 1,
  'geo_code_1' => 0,
  'geo_code_2' => 1,
 ];

@@ -221,6 +226,10 @@ public function processContacts($processGeocode, $parseStreetAddress) {
// when we should found street_number and street_name
if (empty($parsedFields['street_name']) || empty($parsedFields['street_number'])) {
$success = FALSE;
// If an address has failed in the geocoding scheduled job i.e. no lat/long is fetched, we will update the manual_geocode field to 1.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maryguo2023 these 4 lines need to be moved in Old line 214

Copy link
Member

@seamuslee001 seamuslee001 Oct 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the code there should be like the following as this section is about address parsing not geocoding of addresses

        if (isset($params['geo_code_1']) && $params['geo_code_1'] != 'null') {
          $totalGeocoded++;
          $addressParams = $params;
        }
        else {
           // If an address has failed in the geocoding scheduled job i.e. no lat/long is fetched, we will update the manual_geocode field to 1. 
           $addressParams['manual_geo_code'] = TRUE;
           $addressParams['geo_code_1'] = 0;
           $addressParams['geo_code_2'] = 0;
        }

@monishdeb monishdeb force-pushed the improve-geocoding-for-address branch from 8ea205e to 30027f9 Compare November 1, 2023 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants