fix key please

This commit is contained in:
C committed 2026-01-05 15:37:50 -08:00
1 parent 2f7769e2c3
commit 199995b947
2 files changed
+51 -21

No files matched your search

+40 -12
View File
@@ -106,21 +106,49 @@ async def enrich_single_item(item_id: str, item_data: dict = None, logger=None)
# Check if manual price review needed
if lego_set.get("requires_manual_price"):
if logger:
logger.info(f"Item {item_id} requires manual price review (≥$110)")
else:
print(f"[@DEBUG] Item {item_id} requires manual price review")
# Get current Square price to check if it's already over $100
current_price_cents = None
variations = item.get("variations", [])
if variations:
price_money = (
variations[0].get("item_variation_data", {}).get("price_money", {})
)
current_price_cents = price_money.get("amount", 0)
await db.upsert(
"REVIEW",
{
"sq_object": item_id,
"price": lego_set["set_adjustredprice"],
"date_modified": int(time()),
},
"sq_object",
current_price_dollars = (
current_price_cents / 100 if current_price_cents else 0
)
# Only add to review if current price is NOT already over $100
if current_price_dollars <= 100:
if logger:
logger.info(
f"Item {item_id} requires manual price review (≥$110, current: ${current_price_dollars:.2f})"
)
else:
print(
f"[@DEBUG] Item {item_id} requires manual price review (current: ${current_price_dollars:.2f})"
)
await db.upsert(
"REVIEW",
{
"sq_object": item_id,
"price": lego_set["set_adjustredprice"],
"date_modified": int(time()),
},
"sq_object",
)
else:
if logger:
logger.info(
f"Item {item_id} price already over $100 (${current_price_dollars:.2f}), skipping manual review"
)
else:
print(
f"[@DEBUG] Item {item_id} price already over $100 (${current_price_dollars:.2f}), skipping manual review"
)
# Update Square item with enriched data
success = await asquare.update_itm(item_id, lego_set, item_data=item)