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:
@@ -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));
|
||||
});
|
||||
|
||||
|
||||
@@ -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),
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user