You own the Q1 2026 category quality scorecard for an online marketplace. Two merchandising leads filed bugs against the latest run:
- Listing counts look too low for some categories — they can see more active listings on the site than the report admits.
- A weak category (
camping) is showing up as if it cleared the quality bar, even though its listings clearly average below 4.0 stars.
The report is built from three SQL files that run in alphabetical order:
queries/01_eligible_listings.sql narrows the catalog to the active, in-window, external listings that count.
queries/02_category_volume.sql rolls those up to one listing_count per category.
queries/03_category_scorecard.sql is the final dashboard query and joins the two helpers above.
Read all three before changing anything — the two symptoms have two different causes, and they are not in the same file.
Business rules for Q1 2026:
- A listing is eligible only if its
status is active, its category is not archived, its seller is external (is_internal = 0), and it was listed in [2026-01-01, 2026-04-01).
rating is NULL until a listing has been reviewed; an unrated listing is still a real active listing.
- The quality bar is an average rating of at least 4.0, taken over a category's rated listings.