mirror of
https://github.com/clucraft/PriceGhost.git
synced 2026-05-12 09:12:40 +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
|
|
@ -57,6 +57,9 @@ router.post('/', async (req: AuthRequest, res: Response) => {
|
|||
// Store the preferred extraction method and the user-selected price
|
||||
await productQueries.updateExtractionMethod(product.id, selectedMethod);
|
||||
|
||||
// Store the anchor price - used on refresh to select the correct variant
|
||||
await productQueries.updateAnchorPrice(product.id, selectedPrice);
|
||||
|
||||
// Record the user-selected price
|
||||
await priceHistoryQueries.create(
|
||||
product.id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue