Auto-Fill Distributors selects lowest price without regarding Packaging Unit
System Information
- PartKeepr Version: git e4cd430
- Reproducible on the demo system: Yes
How to reproduce
-
Create at least two distributor entries for a part, for example:
- Order number A, packaging unit 1, price per item 1€
- Order number B, packaging unit 1000, price per item 0,80€
-
Create a project report for a project which needs your part once
-
Auto-Fill Distributors
-
partkeepr will fill in order number B and set the price to 0,80€
Obviously, it should fill in order number A as I only need the part once, so 1*1€ < 1000*0,80€. Partkeepr has all information to decide which order number is the better one for this order.
This becomes a problem when using the octopart plugin which fills in the large order quantities from Digikey and others. This bug makes the Auto-Fill feature quite useless as it chooses always the order numbers with the lowest price, which is in most cases the one for are large packaging quantity.
Reproduction in demo system:
Create part with distributor entries

Create project with part

Auto-Fill project report

In the last screenshot you can see partkeepr fills in order number B with order amount 1. But partkeepr knows that you can't order 1 piece of B for 0,80€, you would have to take 1000 pieces as you can see in the first screenshot.
I am having the same issue. Want to add some different price steps for resistors, as they get cheaper per resistor in higher volume.
May be related to https://github.com/partkeepr/PartKeepr/issues/341
Related: https://github.com/partkeepr/PartKeepr/issues/404
This is related to #341 and #404. (As @xxv already mentioned)
However, I do not think that this is a "Backend" bug. This was fixed by me in the JS frontend, just created a pull request (see #341 or #404 for links to that request).
It is quite confusing seeing this as being classified as a "Bug" and the other issues as "Feature Requests". I think that all should be labeled as "Bug" because it does not make sense that PartKeepr would choose a distributor with a packaging unit larger than the part count.