From 7e8fae14e6a5bee1ece691005baba5a02b7fabe5 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Sat, 2 Dec 2023 13:09:12 -0600 Subject: [PATCH] Improve handling of backdated transactions Sometimes transactions show up in the export with the previous day's date. When this happens, these transactions may get skipped, since they might have the same date as the most recent transaction in Firefly. To help avoid skipping transactions, we need the start date to be the same as the most recent transaction, rather than the next day. This can cause duplicate imports, though, but fortunately, the Firefly Data Importer handles this fairly well. --- xactfetch.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xactfetch.py b/xactfetch.py index 271db71..106bfe2 100644 --- a/xactfetch.py +++ b/xactfetch.py @@ -199,7 +199,7 @@ def get_last_transaction_date(key: int, token: str) -> datetime.date: continue if date > last_date: last_date = date - return last_date.date() + datetime.timedelta(days=1) + return last_date.date() def download_chase( @@ -215,7 +215,7 @@ def download_chase( e, ) return False - if start_date >= end_date: + if start_date > end_date: log.info( 'Skipping Chase account: last transaction was %s', start_date, @@ -247,7 +247,7 @@ def download_commerce( e, ) continue - if start_date >= end_date: + if start_date > end_date: log.info( 'Skipping account %s: last transaction was %s', name,