Skip to content

geocode_or_return is inefficient and probably not needed #59

Description

@bglick

In reviewing the code to generate the maps json, I noticed that both the Companies & Groups call geocode_or_return and only load the json if this method returns true.

geocode_or_return calls the external Geocoder api for every address that doesn't have a latitude and longitude already set. Since the Company class already sets the location in the after_validation callback, making the separate API call within the context of an interactive request seems excessive. There's a very low chance that an address would have a positive if it didn't have one when it was most recently saved.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions