fix(price): remove baseprice detection, use directional price match
baseprice > price was wrongly treated as "quantity discount" — it's just GoMag's promotional price. Now: price_gomag <= pret_roa is always OK, only flag when GoMag charges MORE than ROA. Reset cached price_match at startup for re-evaluation. Fix dashboard dot color for mismatches. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -46,6 +46,9 @@ async def backfill_price_match():
|
||||
from ..database import get_sqlite
|
||||
db = await get_sqlite()
|
||||
try:
|
||||
# Reset all cached price_match to re-evaluate with current logic
|
||||
await db.execute("UPDATE orders SET price_match = NULL WHERE price_match IS NOT NULL")
|
||||
await db.commit()
|
||||
cursor = await db.execute("""
|
||||
SELECT order_number FROM orders
|
||||
WHERE status IN ('IMPORTED', 'ALREADY_IMPORTED')
|
||||
@@ -465,9 +468,6 @@ async def order_detail(order_number: str):
|
||||
item["price_match"] = pi.get("match")
|
||||
if pi.get("kit"):
|
||||
item["kit"] = True
|
||||
if pi.get("quantity_discount"):
|
||||
item["quantity_discount"] = True
|
||||
item["baseprice"] = pi.get("baseprice")
|
||||
order_price_check = price_data.get("summary", {})
|
||||
# Cache price_match in SQLite if changed
|
||||
if order_price_check.get("oracle_available") is not False:
|
||||
|
||||
Reference in New Issue
Block a user