Commit 9d4c21a5 authored by Quentin Defenouillere's avatar Quentin Defenouillere Committed by Romain Bignon

[bred] Fetch rdate from PATTERNS if transaction is TYPE_CARD

We first set rdate for all transactions and then apply the parse()
method to replace the rdate if we find a date pattern in the transaction
label (therefore, for transaction of type_card and type_withdrawal).

Closes: 6085@zendesk
parent ac9aab54
...@@ -221,10 +221,10 @@ class SearchPage(LoggedPage, JsonPage): ...@@ -221,10 +221,10 @@ class SearchPage(LoggedPage, JsonPage):
op['details'] = [re.sub('\s+', ' ', i).replace('\x00', '') for i in op['details'] if i] # sometimes they put "null" elements... op['details'] = [re.sub('\s+', ' ', i).replace('\x00', '') for i in op['details'] if i] # sometimes they put "null" elements...
label = re.sub('\s+', ' ', op['libelle']).replace('\x00', '') label = re.sub('\s+', ' ', op['libelle']).replace('\x00', '')
raw = ' '.join([label] + op['details']) raw = ' '.join([label] + op['details'])
t.rdate = date.fromtimestamp(op.get('dateOperation', op.get('dateDebit'))/1000)
vdate = date.fromtimestamp(op.get('dateValeur', op.get('dateDebit', op.get('dateOperation')))/1000) vdate = date.fromtimestamp(op.get('dateValeur', op.get('dateDebit', op.get('dateOperation')))/1000)
t.parse(d, raw, vdate=vdate) t.parse(d, raw, vdate=vdate)
t.amount = Decimal(str(op['montant'])) t.amount = Decimal(str(op['montant']))
t.rdate = date.fromtimestamp(op.get('dateOperation', op.get('dateDebit'))/1000)
if 'categorie' in op: if 'categorie' in op:
t.category = op['categorie'] t.category = op['categorie']
t.label = label t.label = label
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment