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

Problematic Taxons can be created #4849

Closed
RyanofWoods opened this issue Jan 11, 2023 · 0 comments · Fixed by #4851
Closed

Problematic Taxons can be created #4849

RyanofWoods opened this issue Jan 11, 2023 · 0 comments · Fixed by #4851

Comments

@RyanofWoods
Copy link
Contributor

RyanofWoods commented Jan 11, 2023

A lot of these problems are caused by incorrectly creating Taxons via code rather than using the admin page, but some simple validations could prevent these issues.

Solidus Version:
all/master

Issues

  1. A Taxonomy should have one root Taxon, but still multiple Taxon's can be created with a parent_id of nil.

    has_one :root, -> { where parent_id: nil }, class_name: "Spree::Taxon", dependent: :destroy

  2. You can make "duplicate" Taxons, i.e. Taxons that have the same name and parent.
    These both can be fixed with simple validation.

  3. If you have taxons with the same lft and rgt attributes, deleting one, deletes all of them. I am not really sure how this occurred on the project I am working on, but just wanted to share, while I figure out the cause.


I am working on a PR for the first and second issues

@RyanofWoods RyanofWoods changed the title Problematic Taxons can be created Taxon Issues Jan 12, 2023
@RyanofWoods RyanofWoods changed the title Taxon Issues Problematic Taxons can be created Jan 12, 2023
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 a pull request may close this issue.

1 participant