mirror of
https://github.com/clucraft/PriceGhost.git
synced 2026-05-18 13:55:16 +02:00
Add anchor price support for variant products
When a user confirms a price from the modal, we now store it as an "anchor price". On subsequent refreshes, if multiple price candidates are found (common with variant products like different sizes/colors), we select the candidate closest to the anchor price. This fixes the issue where variant products would randomly switch to a different variant's price on refresh. Changes: - Add anchor_price column to products table - Save anchor price when user confirms a price selection - Use anchor price to select correct variant on refresh - 20% tolerance - if no candidate is within 20% of anchor, fall back to consensus Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
bffc427fff
commit
389915a6ec
5 changed files with 70 additions and 7 deletions
|
|
@ -26,11 +26,15 @@ async function checkPrices(): Promise<void> {
|
|||
// Get preferred extraction method for this product (if user previously selected one)
|
||||
const preferredMethod = await productQueries.getPreferredExtractionMethod(product.id);
|
||||
|
||||
// Use voting scraper with preferred method if available
|
||||
// Get anchor price for variant products (the price the user confirmed)
|
||||
const anchorPrice = await productQueries.getAnchorPrice(product.id);
|
||||
|
||||
// Use voting scraper with preferred method and anchor price if available
|
||||
const scrapedData = await scrapeProductWithVoting(
|
||||
product.url,
|
||||
product.user_id,
|
||||
preferredMethod as ExtractionMethod | undefined
|
||||
preferredMethod as ExtractionMethod | undefined,
|
||||
anchorPrice || undefined
|
||||
);
|
||||
|
||||
// Check for back-in-stock notification
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue