From a39a65ed408af7da482a87df17b8291171ec5173 Mon Sep 17 00:00:00 2001 From: Lars Gebhardt-Kusche Date: Fri, 14 Aug 2026 02:34:47 +0200 Subject: [PATCH] asdasd --- custom/apps/mining-checker/assets/js/app.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/custom/apps/mining-checker/assets/js/app.js b/custom/apps/mining-checker/assets/js/app.js index 6c511025..a15d9226 100644 --- a/custom/apps/mining-checker/assets/js/app.js +++ b/custom/apps/mining-checker/assets/js/app.js @@ -1349,7 +1349,10 @@ ? (dailyCurrency === reportCurrency ? dailyAmount : convertCurrencyValue(dailyAmount, dailyCurrency, reportCurrency)) : null; const totalHashrateKh = toKhPerSecond(miner.mining_speed_value, miner.mining_speed_unit) + toKhPerSecond(miner.bonus_speed_value, miner.bonus_speed_unit); - const costPerKh = totalHashrateKh > 0 ? (Number(miner.total_cost_amount) / totalHashrateKh) : null; + const effectiveAmountReport = Number.isFinite(baseAmount) && baseCurrency === reportCurrency + ? baseAmount + : convertCurrencyValue(miner.total_cost_amount, effectiveCurrency, reportCurrency); + const costPerKh = totalHashrateKh > 0 && Number.isFinite(effectiveAmountReport) ? (effectiveAmountReport / totalHashrateKh) : null; return { id: `purchase-${miner.id}`, source: 'miete', @@ -1364,6 +1367,7 @@ daily_cost_report_amount: Number.isFinite(dailyReportAmount) ? dailyReportAmount : null, total_hashrate_kh: totalHashrateKh > 0 ? totalHashrateKh : null, cost_per_kh_amount: Number.isFinite(costPerKh) && costPerKh > 0 ? costPerKh : null, + cost_per_kh_currency: reportCurrency, base_amount: baseAmount, base_currency: baseCurrency, miner_id: miner.id, @@ -1388,7 +1392,8 @@ ? (dailyCurrency === reportCurrency ? dailyAmount : convertCurrencyValue(dailyAmount, dailyCurrency, reportCurrency)) : null; const totalHashrateKh = toKhPerSecond(plan.mining_speed_value, plan.mining_speed_unit) + toKhPerSecond(plan.bonus_speed_value, plan.bonus_speed_unit); - const costPerKh = totalHashrateKh > 0 ? (Number(plan.total_cost_amount) / totalHashrateKh) : null; + const effectiveAmountReport = convertCurrencyValue(plan.total_cost_amount, plan.currency, reportCurrency); + const costPerKh = totalHashrateKh > 0 && Number.isFinite(effectiveAmountReport) ? (effectiveAmountReport / totalHashrateKh) : null; return { id: `plan-${plan.id}`, source: 'manual', @@ -1403,6 +1408,7 @@ daily_cost_report_amount: Number.isFinite(dailyReportAmount) ? dailyReportAmount : null, total_hashrate_kh: totalHashrateKh > 0 ? totalHashrateKh : null, cost_per_kh_amount: Number.isFinite(costPerKh) && costPerKh > 0 ? costPerKh : null, + cost_per_kh_currency: reportCurrency, base_amount: plan.base_price_amount, base_currency: currentSettings.report_currency || 'EUR', payment_type: plan.payment_type, @@ -3561,7 +3567,7 @@ ]), h('td', { key: 'cost-kh' }, row.cost_per_kh_amount !== null && row.cost_per_kh_amount !== undefined ? [ - h('div', { key: 'amount' }, fmtNumber(row.cost_per_kh_amount, 6)), + h('div', { key: 'amount' }, fmtMoney(row.cost_per_kh_amount, row.cost_per_kh_currency || reportCurrency)), row.total_hashrate_kh !== null && row.total_hashrate_kh !== undefined ? h('div', { key: 'hash', className: 'mc-kicker' }, `bei ${fmtNumber(row.total_hashrate_kh, 4)} kH/s`) : null,