hotwax / facilities

App to manage facilities
Apache License 2.0
1 stars 17 forks source link

Zipcode searching does not work for zipcodes starting with 0 #320

Open ymaheshwari1 opened 1 month ago

ymaheshwari1 commented 1 month ago

Current behavior

When searching for a zipcode starting with 0, we get an error regarding zipcode not being found, but there are zipcodes in US starting with 0 (02134).

Expected behavior

Searching should work for all the valid US zipcodes.

Steps to reproduce the issue

  1. Go to details page for any facility
  2. Click the edit button on the Latitude & Longitude card
  3. Search for a zip code starting with 0 (02134) by clicking the Generate button
  4. Verify that an error toast message is displayed
  5. Search for the zipcode again but after removing leading 0 (2134), and verify that the latlng are generated successfully

Can you handle fixing this bug by yourself?

Environment details

Additional information

Update the api payload to pass q: "postcode: 02134 OR 2134" when searching for a zipcode with a leading 0.

Also need to update the logic when checking for valid zipcode on the details page, as when moving to the facility details page, we check whether the postalCode and lat-lng already added on the facility matches or not, and if not we display the postalCode in red, so need to update the logic here that if the added postalCode on the facility starts with a 0, then match the postalCode with the response postal code for both values(02134 OR 2134).

ymaheshwari1 commented 1 month ago

We have similar functionality when adding address to facility, also check for any other place where this needs to be handled.