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

Creating a taxon in backend gives it the wrong parent #846

Closed
CallMeSH opened this issue Feb 11, 2016 · 3 comments
Closed

Creating a taxon in backend gives it the wrong parent #846

CallMeSH opened this issue Feb 11, 2016 · 3 comments
Assignees
Labels
changelog:solidus_backend Changes to the solidus_backend gem type:bug Error, flaw or fault

Comments

@CallMeSH
Copy link

Hello everyone, I just faced an issue trying to create taxons in the backend.
I figured out why but I can't wrap my head around how to solve it.
I thought it would be easier to just describe it.

Steps to reproduce:

  • Create a first taxonomy (T1)
    • Create a first taxon (t1)
  • Create a second taxonomy (T2)
    • Create a first taxon (t2)

So you end up having:

  • Two taxonomies
id taxonomy
1 T1
2 T2
  • Four taxons
id taxons
1 T1
2 t1
3 T2
4 t2

A bug in the coffee script in charge of generating a new taxon causes it to request the creation of the taxon with its parent_id equal to the taxonomy_id instead of the id of the master taxon.

Parameters: {"taxon"=>{"name"=>"New node", "parent_id"=>"2", "child_index"=>"0"}, "taxonomy_id"=>"2"}

When it should be

Parameters: {"taxon"=>{"name"=>"New node", "parent_id"=>"4", "child_index"=>"0"}, "taxonomy_id"=>"2"}

As a result, in the previous example, t2 end up being a child of t1 since it's the second taxon and T2 is the second taxonomy.

The issue is related to the way taxonomy.js.coffee in the get_create_handler handle the call.

Hope it will be helpful enough !

@jhawthorn jhawthorn self-assigned this Feb 11, 2016
@jhawthorn jhawthorn added type:bug Error, flaw or fault changelog:solidus_backend Changes to the solidus_backend gem labels Feb 11, 2016
@jhawthorn
Copy link
Contributor

Thank you for the exemplary bug report, I believe I've addressed the issue (and several others) in #850

@jhawthorn
Copy link
Contributor

Thanks again @CallMeSH. This should be fixed in #850, which is merged if you'd like to check that this is fixed in master.

@CallMeSH
Copy link
Author

I can confirm the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:solidus_backend Changes to the solidus_backend gem type:bug Error, flaw or fault
Projects
None yet
Development

No branches or pull requests

2 participants