Merge pull request #16 from is343/fix/initial-kbb-daily

fix: only parse kbb daily mileage transaction if it has previous data
This commit is contained in:
Robert Dyer
2024-12-14 18:14:41 -06:00
committed by GitHub
+2
View File
@@ -63,6 +63,7 @@ async function getKBB(URL) {
const daily = parseInt(getTagValue(note, 'kbbDailyMileage')); const daily = parseInt(getTagValue(note, 'kbbDailyMileage'));
if (mileage && daily) { if (mileage && daily) {
let lastDate = await getLastTransactionDate(account, undefined, true); let lastDate = await getLastTransactionDate(account, undefined, true);
if (lastDate) {
const parts = lastDate.split('-'); const parts = lastDate.split('-');
lastDate = new Date(parts[0], parts[1] - 1, parts[2]); lastDate = new Date(parts[0], parts[1] - 1, parts[2]);
if (lastDate < new Date()) { if (lastDate < new Date()) {
@@ -81,6 +82,7 @@ async function getKBB(URL) {
} }
} }
} }
}
await api.importTransactions(account.id, [{ await api.importTransactions(account.id, [{
date: new Date(), date: new Date(),