xsDx
All checks were successful
Deploy / deploy-staging (push) Successful in 33s
Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-08-14 02:29:09 +02:00
parent 8bcd445759
commit 6c9f3d3a77
4 changed files with 79 additions and 13 deletions

View File

@@ -321,10 +321,12 @@ final class AnalyticsService
$walletWithdrawals = is_array($settings['wallet_withdrawals'] ?? null) ? $settings['wallet_withdrawals'] : [];
$purchasedMiners = $this->normalizeLegacyHashrateEntries(is_array($settings['purchased_miners'] ?? null) ? $settings['purchased_miners'] : []);
$minerOffers = is_array($settings['miner_offers'] ?? null) ? $settings['miner_offers'] : [];
$currentHashrateMh = $this->totalHashrateMh(array_merge(
$latestMeasurementTs = $this->utcTimestamp((string) ($latest['measured_at'] ?? ''));
$currentHashrateMh = $this->measurementHashrateMh(
is_array($settings['cost_plans'] ?? null) ? $settings['cost_plans'] : [],
$purchasedMiners
));
$purchasedMiners,
$latestMeasurementTs > 0 ? $latestMeasurementTs : null
);
$offerSummary = [];
foreach ($this->expandOfferVariants($minerOffers, $settings) as $offer) {
$offerSummary[] = $this->evaluateMinerOffer($offer, $latest, $latestPriceByCurrency, $currentHashrateMh, $settings);
@@ -1480,11 +1482,11 @@ final class AnalyticsService
$currency = strtoupper(trim((string) ($latest['effective_price_currency'] ?? $latest['price_currency'] ?? '')));
$pricePerCoin = is_numeric($latest['effective_price_per_coin'] ?? null) ? (float) $latest['effective_price_per_coin'] : null;
$dogePerDay = is_numeric($latest['doge_per_day_interval'] ?? null) ? (float) $latest['doge_per_day_interval'] : null;
$currentHashrateMh = $this->totalHashrateMh(array_merge($costPlans, $purchasedMiners));
$baseTs = $this->utcTimestamp((string) ($latest['measured_at'] ?? ''));
if ($baseTs <= 0) {
$baseTs = $this->utcTimestamp($this->currentUtcDateTime());
}
$currentHashrateMh = $this->measurementHashrateMh($costPlans, $purchasedMiners, $baseTs > 0 ? $baseTs : null);
if ($currency === '' || $pricePerCoin === null || $dogePerDay === null || $currentHashrateMh <= 0 || $days <= 0) {
return ['days' => $days, 'revenue' => null, 'cost' => null, 'profit' => null];
@@ -1881,8 +1883,8 @@ final class AnalyticsService
$currency = strtoupper(trim((string) ($latest['effective_price_currency'] ?? $latest['price_currency'] ?? '')));
$pricePerCoin = is_numeric($latest['effective_price_per_coin'] ?? null) ? (float) $latest['effective_price_per_coin'] : null;
$dogePerDay = is_numeric($latest['doge_per_day_interval'] ?? null) ? (float) $latest['doge_per_day_interval'] : null;
$currentHashrateMh = $this->totalHashrateMh(array_merge($costPlans, $purchasedMiners));
$baseTs = $this->utcTimestamp((string) ($latest['measured_at'] ?? ''));
$currentHashrateMh = $this->measurementHashrateMh($costPlans, $purchasedMiners, $baseTs > 0 ? $baseTs : null);
if ($currency === '' || $pricePerCoin === null || $dogePerDay === null || $currentHashrateMh <= 0 || $baseTs <= 0) {
return ['days' => null, 'eta' => null];