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

Categories mapping ignores duplicate names from different paths #24

Open
sle118 opened this issue Mar 6, 2024 · 3 comments
Open

Categories mapping ignores duplicate names from different paths #24

sle118 opened this issue Mar 6, 2024 · 3 comments
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@sle118
Copy link

sle118 commented Mar 6, 2024

Don't mean to bombard you with corner cases, but I did some analysis on an issue I was having with the parts category schema that matches Digikey. There are cases where sub categories are assigned different paths. A good example of this is for Transistors, which exists under both Discrete Semiconductor Products/Transistors and Electronics/Transistors which contains some sub categories as well. When building the category map, it seems like the 2nd instance of Transistors is ignored, which causes some import errors down the road.

The issue happens here.

    for category in categories.values():
        if category.structural or category.ignore:
            continue
        for alias in category.aliases:
            category_map[alias] = category
        if category.name not in ignore:
            if category.name not in category_map:
                category_map[category.name] = category
            else:
                ignore.add(category.name)
                category_map.pop(category.name)

Given that the map is keyed by name rather than by path, this is not a simple fix. So in the meantime, I will rename my duplicate categories in InvenTree and add aliases if I ever import parts that match one of the renamed categories.

thank you!

@30350n
Copy link
Owner

30350n commented Mar 6, 2024

Yeah, I could do something like checking parent category matches recursively if there's multiple matches (I considered this during implementation but ultimately decided against it). But tbh, this is an edge case that you don't really run into with any reasonable setup.

Importing the complete DigiKey category structure into InvenTree is just an awful idea.

@30350n 30350n added bug Something isn't working wontfix This will not be worked on labels Mar 6, 2024
@sle118
Copy link
Author

sle118 commented Mar 6, 2024

Importing the complete DigiKey category structure into InvenTree is just an awful idea.

lol. the idea of a newbe for using the InvenTree system. I am starting to realize this now but I have a good amount of data entered and a goal in mind so cleanup will wait. In the meantime I renamed the duplicates to get around the issue and will select them as aliases when importing parts in that given category. At least this will document the issue if someone was to stumble on the same problem

@sle118 sle118 closed this as completed Mar 7, 2024
@30350n
Copy link
Owner

30350n commented Mar 7, 2024

(Will keep this open, as it's still a bug, but I don't really have time to tackle this, thus the wontfix tag).

@30350n 30350n reopened this Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants