diff --git a/custom/apps/mining-checker/assets/js/app.js b/custom/apps/mining-checker/assets/js/app.js index 23912d68..2dde2239 100644 --- a/custom/apps/mining-checker/assets/js/app.js +++ b/custom/apps/mining-checker/assets/js/app.js @@ -3191,36 +3191,9 @@ const totalHoldingsValue = latest ? convertMeasurementMoney(latest, latest.total_holdings_value, reportCurrency) : null; const earnedValue = latest ? convertMeasurementMoney(latest, latest.earned_value, reportCurrency) : null; const settledCryptoSpendValue = latest ? convertMeasurementMoney(latest, latest.settled_crypto_spend_value, reportCurrency) : null; - const variableEarnedCurrentAsset = latest && latest.holdings_current_asset !== null && latest.holdings_current_asset !== undefined - ? Number(latest.holdings_current_asset) - : null; const fixedCryptoSpendCurrentAsset = latest && latest.fixed_crypto_spend_current_asset !== null && latest.fixed_crypto_spend_current_asset !== undefined ? Number(latest.fixed_crypto_spend_current_asset) : null; - const totalEarnedCurrentAsset = latest && latest.earned_current_asset !== null && latest.earned_current_asset !== undefined - ? Number(latest.earned_current_asset) - : null; - const spentByType = allMinerRows.reduce((summary, row) => { - const amount = Number(row?.effective_amount); - const currency = String(row?.effective_currency || '').toUpperCase(); - if (!Number.isFinite(amount) || amount <= 0 || !currency) { - return summary; - } - - if (row.payment_type === 'crypto') { - const converted = convertCurrencyValue(amount, currency, currentCoinCurrency); - if (Number.isFinite(converted)) { - summary.crypto += converted; - } - return summary; - } - - const converted = convertCurrencyValue(amount, currency, reportCurrency); - if (Number.isFinite(converted)) { - summary.fiat += converted; - } - return summary; - }, { crypto: 0, fiat: 0 }); const breakEvenReached = breakEvenRemainingAmount !== null && breakEvenRemainingAmount <= 0; const breakEvenEta = latest && latest.break_even_eta_at ? fmtDate(latest.break_even_eta_at) : null; const walletBalanceCurrentAsset = payload?.summary?.payouts?.wallet_balance_current_asset; @@ -3271,22 +3244,21 @@ }), h(StatCard, { key: 'earned-overall', - label: `Bisher verdient gesamt ${currentCoinCurrency}`, - value: totalEarnedCurrentAsset !== null ? fmtNumber(totalEarnedCurrentAsset, 6) : 'n/a', + label: `Bisher verdient gesamt ${reportCurrency}`, + value: earnedValue !== null ? fmtMoney(earnedValue, reportCurrency) : 'n/a', sub: [ - variableEarnedCurrentAsset !== null ? `Variabel ${fmtNumber(variableEarnedCurrentAsset, 6)} ${currentCoinCurrency}` : null, - fixedCryptoSpendCurrentAsset !== null ? `Fix ${fmtNumber(fixedCryptoSpendCurrentAsset, 6)} ${currentCoinCurrency}` : null, + totalHoldingsValue !== null ? `Variabel ${fmtMoney(totalHoldingsValue, reportCurrency)}` : null, + settledCryptoSpendValue !== null ? `Fix ${fmtMoney(settledCryptoSpendValue, reportCurrency)}` : null, currentSettings?.baseline_measured_at ? `Seit Baseline ${fmtDate(currentSettings.baseline_measured_at)}` : 'Benötigt Baseline', ].filter(Boolean).join(' · '), }), h(StatCard, { key: 'spent-overall', - label: `Krypto-Ausgaben fix ${currentCoinCurrency}`, - value: fixedCryptoSpendCurrentAsset !== null ? fmtNumber(fixedCryptoSpendCurrentAsset, 6) : 'n/a', + label: `Krypto-Ausgaben fix ${reportCurrency}`, + value: settledCryptoSpendValue !== null ? fmtMoney(settledCryptoSpendValue, reportCurrency) : 'n/a', sub: [ - settledCryptoSpendValue !== null ? `Historischer Gegenwert ${fmtMoney(settledCryptoSpendValue, reportCurrency)}` : null, + fixedCryptoSpendCurrentAsset !== null ? `Entspricht ${fmtNumber(fixedCryptoSpendCurrentAsset, 6)} ${currentCoinCurrency}` : null, 'Kurs aus gespeichertem fx-rates-Snapshot', - `FIAT ${fmtMoney(spentByType.fiat, reportCurrency)}`, ].filter(Boolean).join(' · '), }), h(StatCard, {