xsDx
This commit is contained in:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user