Skip to content

Commit c92ed47

Browse files
committed
fix syncing transactions on new accounts
1 parent 7b8ebd9 commit c92ed47

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

backend/lifehub/modules/finance/service.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,11 @@ def _fetch_new_transactions(self, account: BankAccount) -> None:
260260
bank_transaction_repo = BankTransactionRepository(self.user, self.session)
261261

262262
account_id = self.encryption_service.decrypt_data(account.account_id)
263-
last_sync = (account.last_synced - dt.timedelta(days=1)).strftime("%Y-%m-%d")
263+
last_sync = (
264+
None # New accounts
265+
if account.last_synced == dt.datetime.min
266+
else (account.last_synced - dt.timedelta(weeks=2)).strftime("%Y-%m-%d")
267+
)
264268
account_transactions = gc_api.get_account_transactions(
265269
account_id, last_sync
266270
).booked

0 commit comments

Comments
 (0)