fix(settings): push trading-hours changes to live user prices immediately
Recompute home price display on save, broadcast settings over SSE, and keep last-price status in sync without a user refresh. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -34,6 +34,7 @@ class PriceBroadcastService
|
||||
}
|
||||
|
||||
if (is_array($lastPayload) && $lastPayload !== []) {
|
||||
$lastPayload = app(ConfigService::class)->applyHomePriceDisplayState($lastPayload);
|
||||
$lastPayload = app(ZaarboxPriceService::class)->attachGoldOunceToPayload($lastPayload);
|
||||
}
|
||||
|
||||
@@ -63,7 +64,7 @@ class PriceBroadcastService
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $payload
|
||||
* @return array<string, int|bool>
|
||||
* @return array<string, int|bool|string>
|
||||
*/
|
||||
public static function lastPriceIdentity(array $payload): array
|
||||
{
|
||||
@@ -75,6 +76,7 @@ class PriceBroadcastService
|
||||
'price_last' => (int) ($payload['price_last'] ?? 0),
|
||||
'price' => (int) ($payload['price'] ?? 0),
|
||||
'closed' => (bool) ($payload['closed'] ?? false),
|
||||
'status' => (string) ($payload['status'] ?? ''),
|
||||
'main_product' => (int) ($payload['main_product'] ?? 0),
|
||||
'montzar' => (int) ($payload['montzar'] ?? 0),
|
||||
'zaarbox' => (int) ($payload['zaarbox'] ?? 0),
|
||||
@@ -93,6 +95,7 @@ class PriceBroadcastService
|
||||
return;
|
||||
}
|
||||
|
||||
$lastPayload = app(ConfigService::class)->applyHomePriceDisplayState($lastPayload);
|
||||
$lastPayload = app(ZaarboxPriceService::class)->attachGoldOunceToPayload($lastPayload);
|
||||
|
||||
if (! $this->rememberHashIfChanged(self::LAST_HASH_KEY, self::lastPriceIdentity($lastPayload))) {
|
||||
|
||||
Reference in New Issue
Block a user