mirror of
https://github.com/jez500/pricebuddy.git
synced 2026-11-24 19:58:13 +01:00
A product said "Great time to buy" the moment it was added. With a flat or single-point history the beat fraction is 0, but the current price is trivially the lowest ever seen, so isAllTimeLow fired and floored the score at 9.5. The claim was about a price nothing had been compared to. DealScoreCalculator now takes hasPriceVariation and beatsOtherListings, and short-circuits before the percentile and all-time-low logic when the price has never moved: - no variation, not the cheapest listing -> new `unknown` verdict, "Not enough data yet", score 0 - no variation but cheaper than the product's other URLs -> "Great time to buy", score 8. Not history, but real evidence: it is the best place to buy this today - variation -> unchanged isAllTimeLow is false in both no-variation cases. A low only means something next to a high, and the flag also drives the hero's "cheapest it has ever been" line and the dashboard's ordering. Side effect worth having: the dashboard's "Buy now" section filters on dealScore.score >= 6, so every newly added product used to land in it at 9.5. An `unknown` product scores 0 and stays out. Recomputed against real data: 3 of 11 products change, all of them two readings at an identical price on a single URL. The rest are untouched. Existing products keep their cached verdict until the next price change or `artisan buddy:regenerate-price-cache`.