Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Italy state seed generation #3722

Merged
merged 1 commit into from Oct 7, 2020
Merged

Conversation

@seand7565
Copy link
Contributor

@seand7565 seand7565 commented Jul 29, 2020

Description
Previously, Italy was using the top-level subregions - regions
in Carmen to generate states, however for a mailing address this
is incorrect, and it instead needs to use provinces, which is
nested as the second level of subregions in Carmen. This fixes the
seed generation, allowing for more countries to make this switch
as necessary (there are a handful of other countries that need this)

Also, adds a state:regenerate rake task that updates states for
countries that were generated incorrectly, like Italy. This is so
people updgrading from v2.10 to v2.11 can easily update to the
correct state list.
This has been moved to a rake task, if you want
this functionality, you'll need to copy it over into your own code!
https://gist.github.com/seand7565/6342d7ce7a89b2412fcb4eab7f2c8a61

This PR only fixes Italy, but lays down some structure to allow fixing
other countries that need this treatment. For instance, if Spain needs
to use the nested subregions instead of the top-level subregions, we
just need to add Spains ISO code to countries_that_use_nested_subregions
in states.rb and the ISO array on line 7 of states.rake.

Ref: #3670

Checklist:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have updated Guides and README accordingly to this change (if needed)
  • I have added tests to cover this change (if needed)
  • I have attached screenshots to this PR for visual changes (if needed)
core/lib/tasks/states.rake Outdated Show resolved Hide resolved
core/lib/tasks/states.rake Outdated Show resolved Hide resolved
@seand7565 seand7565 force-pushed the seand7565:fix_italy_states branch from 25cff3e to aa3b311 Aug 4, 2020
@seand7565 seand7565 requested a review from spaghetticode Aug 4, 2020
Copy link
Member

@spaghetticode spaghetticode left a comment

@seand7565 LGTM 👍 thanks!

Copy link
Member

@kennyadsl kennyadsl left a comment

Left a couple of comments, thanks @seand7565

core/db/default/spree/states.rb Outdated Show resolved Hide resolved
core/lib/tasks/states.rake Outdated Show resolved Hide resolved
@seand7565 seand7565 force-pushed the seand7565:fix_italy_states branch 2 times, most recently from ebbb356 to c9c60d8 Sep 29, 2020
Previously, Italy was using the top-level `subregions` - `regions`
in Carmen to generate states, however for a mailing address this
is incorrect, and it instead needs to use `provinces`, which is
nested as the second level of `subregions` in Carmen. This fixes the
seed generation, allowing for more countries to make this switch
as necessary (there are a handful of other countries that need this)

If you want an easy (and possibly destructive) method to update your
states, see the following gist, which contains a rake task for you to
run: https://gist.github.com/seand7565/6342d7ce7a89b2412fcb4eab7f2c8a61
@seand7565 seand7565 force-pushed the seand7565:fix_italy_states branch from c9c60d8 to b343b96 Oct 1, 2020
@aldesantis
Copy link
Member

@aldesantis aldesantis commented Oct 3, 2020

@kennyadsl if this good to go for you? Feel free to merge if yes!

@kennyadsl kennyadsl merged commit 23511db into solidusio:master Oct 7, 2020
15 of 16 checks passed
15 of 16 checks passed
ci/circleci: postgres_rails_master_activestorage Your tests failed on CircleCI
Details
Header rules - solidus-docs No header rules processed
Details
Header rules - solidus-guides No header rules processed
Details
Pages changed - solidus-docs 325 new files uploaded
Details
Pages changed - solidus-guides All files already uploaded
Details
Redirect rules - solidus-docs No redirect rules processed
Details
Redirect rules - solidus-guides No redirect rules processed
Details
Hound Smells good to me. Woof!
Mixed content - solidus-docs No mixed content detected
Details
Mixed content - solidus-guides No mixed content detected
Details
ci/circleci: mysql Your tests passed on CircleCI!
Details
ci/circleci: mysql_rails52 Your tests passed on CircleCI!
Details
ci/circleci: postgres Your tests passed on CircleCI!
Details
ci/circleci: postgres_rails52 Your tests passed on CircleCI!
Details
netlify/solidus-docs/deploy-preview Deploy preview ready!
Details
netlify/solidus-guides/deploy-preview Deploy preview ready!
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.