mirror of
https://github.com/clucraft/PriceGhost.git
synced 2026-05-12 09:12:40 +02:00
Fix anchor price selection - prioritize anchor over method
The previous logic checked preferred method first, which could select a wrong price even when anchor price was available. Now: 1. PRIORITY 1: Anchor price - if user confirmed a price, find closest match (within 10% tolerance) across ALL candidates 2. PRIORITY 2: Preferred method - only used if no anchor match found 3. PRIORITY 3: Consensus voting Also added debug logging to trace anchor price saving and retrieval. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
389915a6ec
commit
8131017f3a
3 changed files with 31 additions and 29 deletions
|
|
@ -59,6 +59,7 @@ router.post('/', async (req: AuthRequest, res: Response) => {
|
|||
|
||||
// Store the anchor price - used on refresh to select the correct variant
|
||||
await productQueries.updateAnchorPrice(product.id, selectedPrice);
|
||||
console.log(`[Products] Saved anchor price ${selectedPrice} for product ${product.id} (method: ${selectedMethod})`);
|
||||
|
||||
// Record the user-selected price
|
||||
await priceHistoryQueries.create(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue