feat(price): detect quantity discounts via baseprice, show Disc. badge

GoMag sends baseprice (catalog price) alongside price (discounted).
When baseprice > price, the item is volume-discounted — skip ROA
price comparison and show amber "Disc." badge instead of false
mismatch. Strikethrough baseprice in price column for transparency.

Pipeline: parse baseprice → store in SQLite → skip in validation →
pass flag to frontend → render badge (desktop + mobile pill badge
with aria-label, opacity 0.6 for dark mode).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Claude Agent
2026-04-07 17:06:37 +00:00
parent 0f817b2130
commit 057e62fc04
10 changed files with 103 additions and 18 deletions

View File

@@ -714,6 +714,13 @@ 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