Skip to content

Commit

Permalink
Merge branch 'revolut-fix-missing-date' into 'master'
Browse files Browse the repository at this point in the history
Fix cases where Completed Date or amt are blank

See merge request egh/ledger-autosync!9
  • Loading branch information
egh committed Aug 28, 2023
2 parents 79dc52a + a1a88ee commit 8b5d026
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/plugins/revolut.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def mk_currency(self, currency):

def convert(self, row):
amt = Decimal(row["Amount"])
if not amt:
return ""
currency = self.mk_currency(row["Currency"])
cleared = row["State"] == "COMPLETED"
if row["Type"] == "TOPUP":
Expand All @@ -48,7 +50,7 @@ def convert(self, row):

date = datetime.datetime.strptime(row["Started Date"], "%Y-%m-%d %H:%M:%S")
aux_date = datetime.datetime.strptime(row["Completed Date"], "%Y-%m-%d %H:%M:%S") if row["Completed Date"] else None
if date.date() == aux_date.date():
if aux_date and (date.date() == aux_date.date()):
aux_date = None

postings = [posting_to, posting_from]
Expand Down

0 comments on commit 8b5d026

Please sign in to comment.