bug: Price coverage on statistics page can exceed 100% #156

Open
opened 2026-05-01 19:27:08 +02:00 by commenter · 2 comments

I suspect when calculating price coverage on the statistics page it's counting individual parts/lots or loose minifigures in the count of items with prices, but not in the total count of items.

In my case it's definitely loose minifigures with prices that are triggering the issue.

I suspect when calculating price coverage on the statistics page it's counting individual parts/lots or loose minifigures in the count of items with prices, but not in the total count of items. In my case it's definitely loose minifigures with prices that are triggering the issue.
FrederikBaerentsen added the Kind/Bug label 2026-06-15 21:17:10 +02:00
FrederikBaerentsen added this to the Version 1.5 milestone 2026-06-15 21:17:13 +02:00
Owner

You were spot on with the diagnosis. That's exactly what was happening.

The price coverage number is items_with_price / total_items. The bug was that the two sides counted different things.

Before the fix:

The numerator already counted every priced item type:

items_with_price = sets_with_price
                 + individual_parts_with_price
                 + individual_minifigs_with_price
                 + part_lots_with_price

But the denominator was only the set count:

total_items = total_sets

So a loose minifigure with a price got added to the top, but nothing got added to the bottom. With enough priced loose minifigs (or individual parts / lots) the top could grow past the total set count, and the percentage went over
100%.

After the fix:

The denominator now mirrors the numerator, same four item types:

total_items = total_sets
            + individual_parts_standalone
            + total_individual_minifigures
            + total_part_lots

I have a working dev build and it will be in the 1.5 release.

You were spot on with the diagnosis. That's exactly what was happening. The price coverage number is `items_with_price / total_items`. The bug was that the two sides counted different things. Before the fix: The numerator already counted every priced item type: ``` items_with_price = sets_with_price + individual_parts_with_price + individual_minifigs_with_price + part_lots_with_price ``` But the denominator was only the set count: `total_items = total_sets` So a loose minifigure with a price got added to the top, but nothing got added to the bottom. With enough priced loose minifigs (or individual parts / lots) the top could grow past the total set count, and the percentage went over 100%. After the fix: The denominator now mirrors the numerator, same four item types: ``` total_items = total_sets + individual_parts_standalone + total_individual_minifigures + total_part_lots ``` I have a working dev build and it will be in the 1.5 release.
Author

Nice, thanks again!

Nice, thanks again!
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: FrederikBaerentsen/BrickTracker#156