ysdsd
This commit is contained in:
@@ -1447,10 +1447,16 @@
|
||||
? (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 effectiveAmountReport = Number.isFinite(baseAmount) && baseCurrency === reportCurrency
|
||||
? baseAmount
|
||||
: convertCurrencyValue(miner.total_cost_amount, effectiveCurrency, reportCurrency);
|
||||
const costPerKh = totalHashrateKh > 0 && Number.isFinite(effectiveAmountReport) ? (effectiveAmountReport / totalHashrateKh) : null;
|
||||
const settledAmount = Number(miner.settled_value_amount);
|
||||
const settledCurrency = String(miner.settled_value_currency || '').toUpperCase();
|
||||
const hasHistoricalSettlement = Number.isFinite(settledAmount) && settledAmount > 0 && settledCurrency;
|
||||
const runtimeDays = Number(miner.runtime_months) * 30.4375;
|
||||
const costPerKhAmount = totalHashrateKh > 0 && Number.isFinite(runtimeDays) && runtimeDays > 0
|
||||
? ((paymentType === 'crypto' && hasHistoricalSettlement ? settledAmount : Number(miner.total_cost_amount)) / totalHashrateKh / runtimeDays)
|
||||
: null;
|
||||
const costPerKhCurrency = paymentType === 'crypto' && hasHistoricalSettlement
|
||||
? settledCurrency
|
||||
: effectiveCurrency;
|
||||
return {
|
||||
id: `purchase-${miner.id}`,
|
||||
source: 'miete',
|
||||
@@ -1464,10 +1470,12 @@
|
||||
daily_cost_currency: dailyCurrency,
|
||||
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,
|
||||
runtime_days: Number.isFinite(runtimeDays) && runtimeDays > 0 ? runtimeDays : null,
|
||||
cost_per_kh_amount: Number.isFinite(costPerKhAmount) && costPerKhAmount > 0 ? costPerKhAmount : null,
|
||||
cost_per_kh_currency: costPerKhCurrency,
|
||||
base_amount: paymentType === 'crypto' && hasHistoricalSettlement ? settledAmount : baseAmount,
|
||||
base_currency: paymentType === 'crypto' && hasHistoricalSettlement ? settledCurrency : baseCurrency,
|
||||
base_label: paymentType === 'crypto' && hasHistoricalSettlement ? 'Fix zum Mietzeitpunkt' : 'Basis',
|
||||
miner_id: miner.id,
|
||||
miner_offer_id: miner.miner_offer_id,
|
||||
payment_type: paymentType,
|
||||
@@ -1490,8 +1498,10 @@
|
||||
? (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 effectiveAmountReport = convertCurrencyValue(plan.total_cost_amount, plan.currency, reportCurrency);
|
||||
const costPerKh = totalHashrateKh > 0 && Number.isFinite(effectiveAmountReport) ? (effectiveAmountReport / totalHashrateKh) : null;
|
||||
const runtimeDays = Number(plan.runtime_months) * 30.4375;
|
||||
const costPerKhAmount = totalHashrateKh > 0 && Number.isFinite(runtimeDays) && runtimeDays > 0
|
||||
? Number(plan.total_cost_amount) / totalHashrateKh / runtimeDays
|
||||
: null;
|
||||
return {
|
||||
id: `plan-${plan.id}`,
|
||||
source: 'manual',
|
||||
@@ -1505,8 +1515,9 @@
|
||||
daily_cost_currency: dailyCurrency,
|
||||
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,
|
||||
runtime_days: Number.isFinite(runtimeDays) && runtimeDays > 0 ? runtimeDays : null,
|
||||
cost_per_kh_amount: Number.isFinite(costPerKhAmount) && costPerKhAmount > 0 ? costPerKhAmount : null,
|
||||
cost_per_kh_currency: plan.currency,
|
||||
base_amount: plan.base_price_amount,
|
||||
base_currency: currentSettings.report_currency || 'EUR',
|
||||
payment_type: plan.payment_type,
|
||||
@@ -3706,7 +3717,7 @@
|
||||
const renderMinerTable = (rows, emptyText) => (
|
||||
h('div', { className: 'mc-table-shell' }, [
|
||||
h('table', { key: 'table', className: 'mc-table' }, [
|
||||
h('thead', { key: 'head' }, h('tr', null, ['Label', 'Start', 'Laufzeit', 'Auto', 'Kosten Server', 'Kosten/kH/s', 'Waehrung', 'Aktiv', 'Aktion'].map((label) => h('th', { key: label }, label)))),
|
||||
h('thead', { key: 'head' }, h('tr', null, ['Label', 'Start', 'Laufzeit', 'Auto', 'Kosten Server', 'Kosten/kH/s/Tag', 'Waehrung', 'Aktiv', 'Aktion'].map((label) => h('th', { key: label }, label)))),
|
||||
h('tbody', { key: 'body' },
|
||||
rows.length
|
||||
? rows.map((row) => h('tr', { key: row.id }, [
|
||||
@@ -3732,14 +3743,14 @@
|
||||
].join(''))
|
||||
: null,
|
||||
row.base_amount !== null && row.base_amount !== undefined && row.base_currency
|
||||
? h('div', { key: 'base', className: 'mc-kicker' }, `Basis ${fmtNumber(row.base_amount, 6)} ${row.base_currency}`)
|
||||
? h('div', { key: 'base', className: 'mc-kicker' }, `${row.base_label || 'Basis'} ${fmtNumber(row.base_amount, 6)} ${row.base_currency}`)
|
||||
: null,
|
||||
]),
|
||||
h('td', { key: 'cost-kh' }, row.cost_per_kh_amount !== null && row.cost_per_kh_amount !== undefined
|
||||
? [
|
||||
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`)
|
||||
? h('div', { key: 'hash', className: 'mc-kicker' }, `bei ${fmtNumber(row.total_hashrate_kh, 4)} kH/s${row.runtime_days !== null && row.runtime_days !== undefined ? ` · ${fmtNumber(row.runtime_days, 2)} Tage` : ''}`)
|
||||
: null,
|
||||
]
|
||||
: 'n/a'),
|
||||
|
||||
Reference in New Issue
Block a user