⚡️ Return early if no transactions were fetched
This commit is contained in:
parent
a2c6c55430
commit
a0cefcdfa1
@ -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<void> {
|
||||
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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user