fix imports and price

This commit is contained in:
C committed 2026-01-05 15:24:50 -08:00
1 parent 832122e63c
commit 1e96dead07
2 files changed
+9 -10

No files matched your search

+8 -8
View File
@@ -7,6 +7,7 @@ import asyncio
import os import os
import aiohttp import aiohttp
import json import json
import math
import dotenv import dotenv
from typing import Dict, Any, Optional from typing import Dict, Any, Optional
from datetime import datetime, timedelta from datetime import datetime, timedelta
@@ -215,22 +216,21 @@ class AsyncBricksetAPI:
barcode_data = set_data.get("barcode", {}) barcode_data = set_data.get("barcode", {})
upc_code = barcode_data.get("UPC") or barcode_data.get("EAN") upc_code = barcode_data.get("UPC") or barcode_data.get("EAN")
# Get retail price before rounding
retail_price = set_data["LEGOCom"]["US"]["retailPrice"]
our_set = { our_set = {
"set_num": set_data["number"], "set_num": set_data["number"],
"set_name": set_data["name"], "set_name": set_data["name"],
"set_theme": set_data["theme"], "set_theme": set_data["theme"],
"set_image": set_data["image"]["thumbnailURL"], "set_image": set_data["image"]["thumbnailURL"],
"set_barcode": upc_code, "set_barcode": upc_code,
"set_retailprice": round( "set_retailprice": round(retail_price),
set_data["LEGOCom"]["US"]["retailPrice"]
),
} }
# Calculate adjusted price (10% markup) # Calculate adjusted price (10% markup), then round up
retail_price = our_set["set_retailprice"] adjusted_price = retail_price * 1.10
our_set["set_adjustredprice"] = retail_price + ( our_set["set_adjustredprice"] = math.ceil(adjusted_price)
(10 / 100) * retail_price
)
# Set PW inventory name with theme # Set PW inventory name with theme
our_set["pw_name"] = ( our_set["pw_name"] = (
+1 -2
View File
@@ -4,6 +4,7 @@ import json
import asyncio import asyncio
import uuid import uuid
import re import re
import traceback
from time import time from time import time
import aiohttp import aiohttp
from io import BytesIO from io import BytesIO
@@ -492,8 +493,6 @@ async def update_itm(item_id: str, lego_set: dict, item_data: dict = None):
except Exception as e: except Exception as e:
print(f"[@ERROR] Failed to update item {item_id}: {e}") print(f"[@ERROR] Failed to update item {item_id}: {e}")
import traceback
traceback.print_exc() traceback.print_exc()
return False return False