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

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
Copy link
Member

@spaghetticode spaghetticode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seand7565 LGTM 👍 thanks!

Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 fix_italy_states branch 2 times, most recently from ebbb356 to c9c60d8 Compare October 1, 2020 13:29
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
@aldesantis
Copy link
Member

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants