demo seed change 4

This commit is contained in:
Urtzi Alfaro
2025-12-14 19:05:37 +01:00
parent 4ae5356ad1
commit 82f9622411
16 changed files with 532 additions and 55 deletions

View File

@@ -157,21 +157,18 @@ async def trigger_safety_stock_optimization(
try:
# Fetch sales data for this product
sales_response = await sales_client.get_sales_data(
sales_data = await sales_client.get_sales_data(
tenant_id=tenant_id,
product_id=product_id,
start_date=start_date.strftime('%Y-%m-%d'),
end_date=end_date.strftime('%Y-%m-%d')
)
if not sales_response or not sales_response.get('sales'):
if not sales_data:
logger.warning(
f"No sales history for product {product_id}, skipping"
)
continue
# Convert sales data to daily demand
sales_data = sales_response.get('sales', [])
demand_data = []
for sale in sales_data: