NO LOCATION AAAAH

This commit is contained in:
C committed 2026-01-04 13:34:51 -08:00
1 parent 0f68b09a00
commit a2746737ce
2 files changed
+13 -10

No files matched your search

+11
View File
@@ -52,6 +52,17 @@ def on_starting(server):
"""Called just before the master process is initialized.""" """Called just before the master process is initialized."""
print("Studspider WEB starting...") print("Studspider WEB starting...")
# Load .env file before workers start
import dotenv
from pathlib import Path
env_path = Path(__file__).parent.parent / ".env"
if env_path.exists():
dotenv.load_dotenv(env_path)
print(f"✓ Loaded environment from {env_path}")
else:
print(f"⚠ No .env file found at {env_path}")
def on_reload(server): def on_reload(server):
"""Called to recycle workers during a reload via SIGHUP.""" """Called to recycle workers during a reload via SIGHUP."""
+2 -10
View File
@@ -306,12 +306,12 @@ async def update_itm(item_id: str, lego_set: dict, item_data: dict = None):
if variation_version is not None: if variation_version is not None:
variation_obj["version"] = variation_version variation_obj["version"] = variation_version
# Build item object matching variation's location settings # Build item object - DO NOT modify location settings
# Square will preserve existing present_at_all_locations configuration
item_obj = { item_obj = {
"type": "ITEM", "type": "ITEM",
"id": item_id, "id": item_id,
"version": current_version, "version": current_version,
"present_at_all_locations": present_at_all_locations,
"item_data": { "item_data": {
"name": pw_name, "name": pw_name,
"description": f"{set_name} - {set_theme}", "description": f"{set_name} - {set_theme}",
@@ -319,14 +319,6 @@ async def update_itm(item_id: str, lego_set: dict, item_data: dict = None):
"variations": [variation_obj], "variations": [variation_obj],
}, },
} }
# Only include present_at_location_ids if not at all locations
if not present_at_all_locations and present_at_location_ids:
item_obj["present_at_location_ids"] = present_at_location_ids
upsert_body = {
"idempotency_key": str(uuid.uuid4()),
"object": item_obj,
} }
# Remove None values # Remove None values