From 7523cea4b2630a6af4e4fb726e9fc3ff79def646 Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Tue, 19 Mar 2013 13:43:31 +0100 Subject: [PATCH] parse only operation dates for date transactions Dates in labels are dd/mm for card transactions, but can be mm/yy for other kind of transactions. --- modules/cragr/web/pages.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/cragr/web/pages.py b/modules/cragr/web/pages.py index 09b15e8c..f414f69c 100644 --- a/modules/cragr/web/pages.py +++ b/modules/cragr/web/pages.py @@ -156,17 +156,17 @@ class TransactionsPage(BasePage): # Sometimes, the category contains the label, even if there is another line with it again. t.category = re.sub('(.*) .*', r'\1', t.category).strip() + t.type = self.TYPES.get(t.category, t.TYPE_UNKNOWN) + # Parse operation date in label (for card transactions for example) m = re.match('(.*) (\d{2})/(\d{2})$', t.label) if m: - t.rdate = date_guesser.guess_date(int(m.group(2)), int(m.group(3)), change_current_date=False) + if t.type == t.TYPE_CARD: + t.rdate = date_guesser.guess_date(int(m.group(2)), int(m.group(3)), change_current_date=False) t.label = m.group(1).strip() # Strip city or other useless information from label. t.label = re.sub('(.*) .*', r'\1', t.label).strip() - - t.type = self.TYPES.get(t.category, t.TYPE_UNKNOWN) - t.set_amount(value) yield t