Open kvotolato3 opened 8 years ago
[x-post from https://github.com/codeforboston/cambridge_energy_app/pull/213]
I wonder if you could use a Google Maps or other API or to fire off quick on-input-change AJAX to generate choose-from/auto-complete options when a user enters their building address. Would save a lot of achy-breaky reinvent-the-wheel logic and seems intuitive from a UX standpoint.
https://developers.google.com/maps/documentation/javascript/places-autocomplete#introduction
Whenever someone creates a new unit (from /units/new), the system checks to see if the string they typed into the address field matches any others in the database, and if it does, it uses the existing address. If it does not, it will create one. I think the logic is perfect, but we need to figure out how to handle our street addresses in a more granular fashion (i.e. address 1, address 2, city, state, zip, etc.) to prevent duplicate User Buildings. Plus, we will be able to validate them better and be more in line with the data from the Green Button API when we finally get that integrated.