This commit is contained in:
2024-07-07 13:53:25 +03:00
parent bc2fef91c4
commit 1bb5c6cbbb
2 changed files with 7 additions and 3 deletions

View File

@@ -243,7 +243,7 @@ async def get_stocks_data(
),
else_=0)
.label('warehouse_stock'),
func.coalesce(mix_stock_full_subquery.c.mix_stock, 0).label('mix_stock'),
mix_stock_full_subquery.c.mix_stock.label('mix_stock'),
func.coalesce(in_block_subquery.c.in_block_value, 1).label('in_block_value'),
is_master_subquery.c.is_master.label('is_master'),
func.coalesce(slaves_stock_subquery.c.slaves_stock, 0).label('slaves_stock'),
@@ -313,6 +313,10 @@ async def get_stocks_data(
})
continue
is_mix = mix_stock is not None
if not mix_stock:
mix_stock = 0
if all([is_mix, slaves_stock > 0]):
mix_stock = 0
balance_limit = price_purchase > company.balance
@@ -338,5 +342,4 @@ async def get_stocks_data(
'full_stock': full_stock,
'marketplace_product': marketplace_product,
})
return response