Skip to content

Commit

Permalink
add last bank sync tracking back in (#4472)
Browse files Browse the repository at this point in the history
* add last sync tracking back in

* note

* type

* db.update
  • Loading branch information
matt-fidd authored Feb 27, 2025
1 parent 7f50c73 commit 1c931cf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/loot-core/src/server/accounts/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -628,13 +628,13 @@ type SyncResponse = {
updatedAccounts: Array<AccountEntity['id']>;
};

function handleSyncResponse(
async function handleSyncResponse(
res: {
added: Array<TransactionEntity['id']>;
updated: Array<TransactionEntity['id']>;
},
acct: db.DbAccount,
): SyncResponse {
): Promise<SyncResponse> {
const { added, updated } = res;
const newTransactions: Array<TransactionEntity['id']> = [];
const matchedTransactions: Array<TransactionEntity['id']> = [];
Expand All @@ -647,6 +647,9 @@ function handleSyncResponse(
updatedAccounts.push(acct.id);
}

const ts = new Date().getTime().toString();
await db.update('accounts', { id: acct.id, last_sync: ts });

return {
newTransactions,
matchedTransactions,
Expand Down Expand Up @@ -745,7 +748,7 @@ async function accountsBankSync({
acct.bankId,
);

const syncResponseData = handleSyncResponse(syncResponse, acct);
const syncResponseData = await handleSyncResponse(syncResponse, acct);

newTransactions.push(...syncResponseData.newTransactions);
matchedTransactions.push(...syncResponseData.matchedTransactions);
Expand Down Expand Up @@ -848,7 +851,10 @@ async function simpleFinBatchSync({
),
);
} else {
const syncResponseData = handleSyncResponse(syncResponse.res, account);
const syncResponseData = await handleSyncResponse(
syncResponse.res,
account,
);

newTransactions.push(...syncResponseData.newTransactions);
matchedTransactions.push(...syncResponseData.matchedTransactions);
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/4472.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [matt-fidd]
---

Add last bank sync tracking back in

0 comments on commit 1c931cf

Please sign in to comment.