fixes #20 - bitcoin sync was negated and ignoring transactions from today
This commit is contained in:
+4
-2
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user