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

[bug] crash when using alternate mode with IPN, parameter do not get added #163

Closed
T0jan opened this issue Jun 21, 2023 · 9 comments
Closed
Labels
bug Something isn't working

Comments

@T0jan
Copy link
Collaborator

T0jan commented Jun 21, 2023

Hi,

I tried to update existing parts with Ki-nTree today but run into two problems:

  • When entering a IPN and no Part ID as suggested by the tool tip the request to inventree results in a timeout.
  • Using the ID finds the part but does not add any new parameters to it or even checks them. Manufacturer Part and Supplier part however are checked. Not sure if this is intended?

Greetings.

@T0jan
Copy link
Collaborator Author

T0jan commented Jun 22, 2023

source for the first bug is this line here:

parts = Part.list(inventree_api)

instead of downloading just the entry for the given IPN it tries to download the whole database which obviously will end in a timeout for bigger databases. Changing the line to parts = Parts.list(inventree_api, IPN=part_ipn) or parts = Parts.list(inventree_api, IPN_regex=part_ipn) in case a more lenient search is intended should fix this. also would mean, that the loop afterwards could be replaced by a simple if condition.

@eeintech eeintech added the bug Something isn't working label Jun 22, 2023
@eeintech
Copy link
Contributor

Hi @T0jan, good catch!

Do you want to send a PR for this?

@T0jan
Copy link
Collaborator Author

T0jan commented Jun 22, 2023

@eeintech I will fix it as part of the implementation of #162. However any opinions on the other point?

Using the ID finds the part but does not add any new parameters to it or even checks them. Manufacturer Part and Supplier part however are checked. Not sure if this is intended?

@eeintech
Copy link
Contributor

@eeintech I will fix it as part of the implementation of #162. However any opinions on the other point?

Using the ID finds the part but does not add any new parameters to it or even checks them. Manufacturer Part and Supplier part however are checked. Not sure if this is intended?

I actually didn't intend the Part ID / IPN to be used to update parts but only to add alternates. This is an interesting use case though... In this case the "Alternate" switch should be more generic, but I'm not sure how I feel about it yet.
Also have you tried to use the manufacturer PN to do a new search and add from scratch? It should find your already existing part but can't remember if parameters are updated... will have to try later

@T0jan
Copy link
Collaborator Author

T0jan commented Jun 22, 2023

@eeintech

It should find your already existing part but can't remember if parameters are updated... will have to try later

yes this works but only for parts which have a Manufacturer part entry with the same MPN already. sadly we have a lot of components created by hand or migrated from other databases which do not have this entry.

Also I have to say I did not understand the purpose of the alternate mode as a mode to create alternates, if I get asked for an existing ID/IPN I expect this then to update the given part with the distributor information but maybe that's just me 😅

@eeintech
Copy link
Contributor

@T0jan Umm I'm surprised this is not obvious from UX standpoint:

image

What does "Alternate" means to you?

@T0jan
Copy link
Collaborator Author

T0jan commented Jun 22, 2023

@eeintech I understood it as an alternate input mask to the standard category/IPN Category Code selection. But with your explanation I see your point. maybe instead of modifying the alternate mode adding a second switch for an similar update mode would be an idea?

@eeintech
Copy link
Contributor

Oh I see, this name is so telling to me in the world of electronic components that I forgot the generic meaning can be lead to other interpretation. Maybe an "Create/Update" switch would be a good idea 👍

@T0jan
Copy link
Collaborator Author

T0jan commented Aug 4, 2023

fixed with #167, closing

@T0jan T0jan closed this as completed Aug 4, 2023
@T0jan T0jan mentioned this issue Jan 15, 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
Projects
None yet
Development

No branches or pull requests

2 participants