fixes #20 - bitcoin sync was negated and ignoring transactions from today

This commit is contained in:
Robert Dyer
2025-03-04 19:25:00 -06:00
parent b8583354de
commit 6db3587fab
+4 -2
View File
@@ -48,14 +48,16 @@ async function getBitcoinPrice() {
if (account.closed) {
continue;
}
const note = await getAccountNote(account);
const cutoffDate = new Date();
cutoffDate.setDate(cutoffDate.getDate() + 1);
const note = await getAccountNote(account, cutoffDate);
if (!note || note.indexOf("BTC:") === -1) {
continue;
}
const btc_amount = note.split('BTC:')[1].split(' ')[0];
const currentBalance = await getAccountBalance(account);
const targetBalance = Math.round(bitcoinPrice * btc_amount * 100);
const diff = currentBalance - targetBalance;
const diff = targetBalance - currentBalance;
if (diff != 0) {
await api.importTransactions(account.id, [{
date: new Date(),