From a0cefcdfa1ea62266602b7cf205ab59705df8c16 Mon Sep 17 00:00:00 2001 From: Martin Berg Alstad Date: Sun, 16 Feb 2025 18:00:25 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Return=20early=20if=20no?= =?UTF-8?q?=20transactions=20were=20fetched?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index e1848f2..6f7a7c3 100644 --- a/src/main.ts +++ b/src/main.ts @@ -15,7 +15,6 @@ import { Sparebank1Impl } from "@sb1impl/sparebank1.ts" // TODO move tsx to devDependency. Requires ts support for Node with support for @ alias // TODO verbatimSyntax in tsconfig, conflicts with jest // TODO store last fetched date in db, and refetch from that date, if app has been offline for some time -// TODO do not fetch if saturday or sunday async function main(): Promise { logger.info("Starting application") @@ -38,6 +37,11 @@ export async function moveTransactions( ) logger.info(`Fetched ${actualTransactions.length} transactions`) + if (actualTransactions.length === 0) { + logger.debug("No transactions to import, skipping") + return + } + const transactionsByAccount = Object.groupBy( actualTransactions, (transaction) => transaction.account,