Closed kavimuru closed 1 year ago
Triggered auto assignment to @kadiealexander (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Platforms
in OP are β
)We want to ensure that State/Province field is filled with a state or province, rather than a country.
The administrative_area_level_1 param that we're currently using from addressComponents to fill out the State/Province field is actually the country (England, Wales, Scotland, etc.) for UK addresses. According to Google's docs, administrative_area_level_1 is only really "guaranteed" to be a state for US addresses.
For UK addresses, we should use administrative_area_level_2 instead. So we need to pull it in here, maybe calling it stateFallback: https://github.com/Expensify/App/blob/2bdeca5460f22610bfd18e5ef44ff3c56b2c2e6a/src/components/AddressSearch/index.js#L109-L130 Making sure in the getAddressComponents call that we pull in the long_name as we are not using the state picker for non-US addresses. So we'll get something like: const { street_number: streetNumber, route: streetName, subpremise, locality, sublocality, postal_town: postalTown, postal_code: zipCode, administrative_area_level_1: state, administrative_area_level_2: stateFallback, country, } = GooglePlacesUtils.getAddressComponents(addressComponents, { street_number: 'long_name', route: 'long_name', subpremise: 'long_name', locality: 'long_name', sublocality: 'long_name', postal_town: 'long_name', postal_code: 'long_name', administrative_area_level_1: 'short_name', administrative_area_level_2: 'long_name', country: 'short_name', }); Then we use the field to override the state for UK addresses only, which can go after this: https://github.com/Expensify/App/blob/2bdeca5460f22610bfd18e5ef44ff3c56b2c2e6a/src/components/AddressSearch/index.js#L163-L167 // UK addresses return the country (e.g. England) in the state field we use for other countries if (country === 'GB') { values.state = stateFallback; }
Non-US addresses where administrative_area_level_1 IS the state/province:
Able to reproduce:
@kavimuru could you please tag the person who submitted the proposal in the post?
Job added to Upwork: https://www.upwork.com/jobs/~0101458ae8ee232f2f
Current assignee @kadiealexander is eligible for the External assigner, not assigning anyone new.
Triggered auto assignment to Contributor-plus team member for initial proposal review - @mollfpr (External
)
Triggered auto assignment to @MonilBhavsar (External
), see https://stackoverflow.com/c/expensify/questions/7972 for more details.
@kadiealexander That one's mine (see here). I'm going to repost as it looks like some of the formatting went wonky!
We want to ensure that State/Province field is filled with a state or province, rather than a country.
The administrative_area_level_1
param that we're currently using from addressComponents
to fill out the State/Province field is actually the country (England, Wales, Scotland, etc.) for UK addresses. According to Google's docs, administrative_area_level_1
is only really "guaranteed" to be a state for US addresses.
For UK addresses, we should use administrative_area_level_2
instead. So we need to pull it in here, maybe calling it stateFallback
:
Making sure in the getAddressComponents
call that we pull in the long_name
as we are not using the state picker for non-US addresses. So we'll get something like:
const {
street_number: streetNumber,
route: streetName,
subpremise,
locality,
sublocality,
postal_town: postalTown,
postal_code: zipCode,
administrative_area_level_1: state,
administrative_area_level_2: stateFallback,
country,
} = GooglePlacesUtils.getAddressComponents(addressComponents, {
street_number: 'long_name',
route: 'long_name',
subpremise: 'long_name',
locality: 'long_name',
sublocality: 'long_name',
postal_town: 'long_name',
postal_code: 'long_name',
administrative_area_level_1: 'short_name',
administrative_area_level_2: 'long_name',
country: 'short_name',
});
Then we use the field to override the state for UK addresses only, which can go after this:
// UK addresses return the country (e.g. England) in the state field we use for other countries
if (country === 'UK') {
values.state = stateFallback;
}
Non-US addresses where administrative_area_level_1
IS the state/province:
UK addresses where administrative_area_level_1
is country:
We discussed in the bug report slack thread, and the expected behavior is - For UK addresses, we won't display country(England/Wales/Scotland/Northern Ireland) in state/province field, instead get the real state/province from google API cc @mollfpr
Sorry for the delay! I'll start reviewing the proposals!
@MonilBhavsar checked the @jjcoffee proposal, and it works well. We can go with their proposal!.
π π π C+ reviewed!
Looks good to me too π
π£ @jjcoffee You have been assigned to this job by @MonilBhavsar! Please apply to this job in Upwork and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review π§βπ» Keep in mind: Code of Conduct | Contributing π
@mollfpr, @jjcoffee, @MonilBhavsar, @kadiealexander Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
Chill Melv - we're just waiting for production deploy
Reviewing
label has been removed, please complete the "BugZero Checklist".
The solution for this issue has been :rocket: deployed to production :rocket: in version 1.3.17-5 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2023-06-01. :confetti_ball:
After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
As a reminder, here are the bonuses/penalties that should be applied for any External issue:
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
[@mollfpr] The PR that introduced the bug has been identified. Link to the PR: [@mollfpr] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
No offending PR. This is an edge case and improvement for UK addresses.
[@mollfpr] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
Regression should be enough.
[@mollfpr] Determine if we should create a regression test for this bug.
Indeed.
[@mollfpr] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
Propose regression step
Contracts sent to @mollfpr and @jjcoffee :)
Assigned: May 17th 3am GMT+12 Merged: May 19th 5:35pm GMT+12
Qualifies for the speed bonus :)
@kadiealexander Accepted, thanks! Also just to note that the reporting bonus is also due for me.
Paid $1750 to @jjcoffee (Job + speed bonus + reporting bonus) Paid $1500 to @mollfpr (job + speed bonus)
Thanks for the awesome work team!
If you havenβt already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
State/Province field should only be populated with a state or county
Actual Result:
State/Province field is populated with a country
Workaround:
Can the user still use Expensify without this being fixed? Have you informed them of the workaround?
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.12.0 Reproducible in staging?: y Reproducible in production?: If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Notes/Photos/Videos: Any additional supporting documentation
Expensify/Expensify Issue URL: Issue reported by: @jjcoffee Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1683624757070259
View all open jobs on GitHub
Upwork Automation - Do Not Edit