Closed cmidgley closed 2 months ago
I've probably glanced over that hardcoded '5' like a houndred times and thought to myself: I shoud really make this into a config parameters but never got around to it somehow. There's two new parameters (interactive_category_matches
and interactive_parameter_matches
) now, which allow you to set this in your config.
Regarding max_results
: I renamed this to interactive_part_matches
as this reflects what it does better, it hasn't only been used by Reichelt (see here): https://github.com/30350n/inventree_part_import/blob/21810dc3c272042da7219e2feb8553b7a7efdb8b/inventree_part_import/part_importer.py#L74
But for Reichelt it's kind of relevant because I have to scrape once per search result (so you really want a small limit here).
Tested and confirmed working. Thanks!
Thanks!
Summary
A proposal to increase the minimum number of properties shown in interactive mode when choosing a matching property and value.
Background
When in interactive mode and importing a part that doesn't match the required parameters, a list of properties is shown that the user can select from, such as:
Having the list with values is great, unless it's not in the first five lines. Even with the fuzz match, I find it often misses the properties I need. This results in a challenging workflow as you need to go to the vendor site, try to find the available vendor properties, and hand enter either the value (or better, the parameter name). As a work-around, in my hooks.py file, I've added a
pprint.pprint(api_part)
as this at least dumps all values, but it's rather ugly!Solutions
The easiest solution is to increase the number of lines, such as in part_importer.py, function select_parameter():
A better solution might be to have it in
config.yaml
. I see there is amax_results
, and it's only supported bysupplier_reichelt.py
, and since I don't use them I'm unsure what it does, but guessing using it for this purposes would be overloading it (so perhaps create a newmax_interactive_properties
value?)I'm glad to make a pull, but thought I'd get your feedback on this prior to doing the work.