Skip to content

Wrong AVG price due to different order tiers #1391

@sziszi90

Description

@sziszi90

Describe the bug
On the part detail info page, the average price range calculation is wrong. It happens when in the shopping information, multiple suppliers with different tier quantities are introduced. The current price calculation takes the last tier and averages between the multiple suppliers. Since not all suppliers have similar qty tiers, this can lead to significant price errors.

To Reproduce
Check printscreen. (0.5788(100pcs_tier)+0.488(5000pcs_tier))/2=0.53334

Expected behavior
It should take the largest qty tier price and show that one if no other supplier has the same offer, otherwise calculate the average. (In this case 0.488)

Screenshots

Image

Server Side

  • Part-DB Version: 2.12.0
  • PHP Version:
  • Database Server

Desktop (please complete the following information):

  • OS: Debian12
  • Browser Chrome

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions