Fix historical crypto settlement calculations
All checks were successful
Deploy / deploy-staging (push) Successful in 34s
Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-09-13 00:18:43 +02:00
parent 72b7202a8a
commit d0dd38823d
7 changed files with 121 additions and 14 deletions

View File

@@ -2319,6 +2319,29 @@
}
}
async function repairHistoricalRecoveryFx() {
setSaving(true);
setError('');
setMessage('');
try {
await request(`${apiBase}/projects/${encodeURIComponent(projectKey)}/historical-recovery-fx`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
measured_at: recoveryForm.miner_at,
doge_usd: recoveryForm.doge_usd,
usd_eur: recoveryForm.usd_eur,
}),
});
await loadBootstrap(projectKey);
setMessage('Historischer FX-Snapshot und zugehoeriger Miner wurden korrigiert.');
} catch (err) {
setError(`Historischer FX-Snapshot konnte nicht korrigiert werden: ${err.message}`);
} finally {
setSaving(false);
}
}
async function submitWalletSnapshotFromPreview(previewOverride) {
const preview = normalizeOcrPreview(previewOverride || ocrPreview);
const raw = {
@@ -3334,7 +3357,6 @@
value: earnedValue !== null ? fmtMoney(earnedValue, reportCurrency) : 'n/a',
sub: [
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(' · '),
}),
@@ -3487,6 +3509,12 @@
className: 'mc-button mc-button--primary',
disabled: saving,
}, saving ? 'Speichert …' : 'Alle Daten nachtragen'),
h('button', {
type: 'button',
className: 'mc-button mc-button--ghost',
onClick: repairHistoricalRecoveryFx,
disabled: saving,
}, 'Nur historischen FX/Miner korrigieren'),
])),
]);
}