fix imports and price
This commit is contained in:
1 parent
832122e63c
commit
1e96dead07
2 files changed
+9
-10
No files matched your search
+8
-8
@@ -7,6 +7,7 @@ import asyncio
|
||||
import os
|
||||
import aiohttp
|
||||
import json
|
||||
import math
|
||||
import dotenv
|
||||
from typing import Dict, Any, Optional
|
||||
from datetime import datetime, timedelta
|
||||
@@ -215,22 +216,21 @@ class AsyncBricksetAPI:
|
||||
barcode_data = set_data.get("barcode", {})
|
||||
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 = {
|
||||
"set_num": set_data["number"],
|
||||
"set_name": set_data["name"],
|
||||
"set_theme": set_data["theme"],
|
||||
"set_image": set_data["image"]["thumbnailURL"],
|
||||
"set_barcode": upc_code,
|
||||
"set_retailprice": round(
|
||||
set_data["LEGOCom"]["US"]["retailPrice"]
|
||||
),
|
||||
"set_retailprice": round(retail_price),
|
||||
}
|
||||
|
||||
# Calculate adjusted price (10% markup)
|
||||
retail_price = our_set["set_retailprice"]
|
||||
our_set["set_adjustredprice"] = retail_price + (
|
||||
(10 / 100) * retail_price
|
||||
)
|
||||
# Calculate adjusted price (10% markup), then round up
|
||||
adjusted_price = retail_price * 1.10
|
||||
our_set["set_adjustredprice"] = math.ceil(adjusted_price)
|
||||
|
||||
# Set PW inventory name with theme
|
||||
our_set["pw_name"] = (
|
||||
|
||||
+1
-2
@@ -4,6 +4,7 @@ import json
|
||||
import asyncio
|
||||
import uuid
|
||||
import re
|
||||
import traceback
|
||||
from time import time
|
||||
import aiohttp
|
||||
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:
|
||||
print(f"[@ERROR] Failed to update item {item_id}: {e}")
|
||||
import traceback
|
||||
|
||||
traceback.print_exc()
|
||||
return False
|
||||
|
||||
|
||||
Reference in new issue
Block a user