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:
@@ -714,13 +714,6 @@ def get_prices_for_order(items: list[dict], app_settings: dict, conn=None) -> di
|
||||
result_items[idx]["kit"] = True
|
||||
continue
|
||||
|
||||
# Quantity discount: baseprice > price means GoMag applied a volume discount
|
||||
baseprice = float(item.get("baseprice") or 0)
|
||||
if baseprice > 0 and baseprice > pret_gomag + 0.01:
|
||||
result_items[idx]["quantity_discount"] = True
|
||||
result_items[idx]["baseprice"] = baseprice
|
||||
continue
|
||||
|
||||
pret_roa_total = 0.0
|
||||
all_resolved = True
|
||||
|
||||
@@ -766,7 +759,7 @@ def get_prices_for_order(items: list[dict], app_settings: dict, conn=None) -> di
|
||||
continue
|
||||
|
||||
pret_roa = round(pret_roa_total, 4)
|
||||
match = abs(pret_gomag - pret_roa) < 0.01
|
||||
match = pret_gomag <= pret_roa + 0.01
|
||||
result_items[idx]["pret_roa"] = pret_roa
|
||||
result_items[idx]["match"] = match
|
||||
checked += 1
|
||||
|
||||
Reference in New Issue
Block a user