fix(sse): send per-product trade_open from server trading hours

The list stream must tell clients whether each product is open so the device clock cannot reopen a closed shop.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-05 12:58:14 +03:30
co-authored by Cursor
parent 166764d6b8
commit 1c7ea16300
2 changed files with 5 additions and 1 deletions
@@ -715,7 +715,10 @@ class ProductController extends SuperController
$displayPriceService = app(ProductDisplayPriceService::class);
$displayPriceService->warmLivePriceCache();
$displayPriceService->enrichForApi($products);
$products->each(function (Product $product) use ($displayPriceService) {
$config = app(ConfigService::class);
$products->each(function (Product $product) use ($displayPriceService, $config) {
$tradeOpen = $config->isProductWithinTradingHours($product);
$product->setAttribute('trade_open', $tradeOpen);
$product->setAttribute('show', $displayPriceService->resolveCustomerShow($product));
});
+1
View File
@@ -207,6 +207,7 @@ class PriceBroadcastService
'reading_method' => (string) ($product['reading_method'] ?? ''),
'price_offset_percent' => (float) ($product['price_offset_percent'] ?? 0),
'show' => (bool) ($product['show'] ?? true),
'trade_open' => (bool) ($product['trade_open'] ?? $product['show'] ?? true),
'active' => (bool) ($product['active'] ?? true),
'reference_provider_active' => (bool) ($product['reference_provider_active'] ?? false),
];