codeforboston / cambridge_energy_app

EnerSave is designed to help and encourage Cambridge residents to reduce their electric bills.
https://www.enersaveapp.org/
MIT License
33 stars 25 forks source link

User Buildings - addresses should be more granular #182

Open kvotolato3 opened 8 years ago

kvotolato3 commented 8 years ago

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.

whilei commented 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