rewritten crap

This commit is contained in:
2025-05-11 07:46:57 +03:00
parent 41a5fb91f3
commit b5110ec69a
20 changed files with 475 additions and 193 deletions

View File

@@ -13,6 +13,7 @@ class StockData(TypedDict):
full_stock: int
article: Union[str, int]
marketplace_product: MarketplaceProduct
product_id: int
def get_marketplace_suppliers_and_company_warehouses(marketplace: Marketplace):
@@ -267,7 +268,7 @@ async def get_stocks_data(
func.coalesce(slaves_stock_subquery.c.slaves_stock, 0).label('slaves_stock'),
MarketplaceProduct.price_recommended.label('price_recommended'),
MarketplaceProduct.is_archived.label('is_archived'),
func.coalesce(fbo_stock_subquery.c.quantity,0).label('fbo_stock')
func.coalesce(fbo_stock_subquery.c.quantity, 0).label('fbo_stock')
)
.select_from(
MarketplaceProduct
@@ -337,13 +338,16 @@ async def get_stocks_data(
'article': denco_article,
'full_stock': 0,
'marketplace_product': marketplace_product,
'product_id': marketplace_product.product_id
})
continue
if fbo_stock> 0 and prefer_fbo_over_fbs:
if fbo_stock > 0 and prefer_fbo_over_fbs:
response.append({
'article': denco_article,
'full_stock': 0,
'marketplace_product': marketplace_product,
'product_id': marketplace_product.product_id
})
continue
is_mix = mix_stock is not None
@@ -375,5 +379,7 @@ async def get_stocks_data(
'article': denco_article,
'full_stock': full_stock,
'marketplace_product': marketplace_product,
'product_id': marketplace_product.product_id
})
return response